Linux USB
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Badhri Jagan Sridharan <badhri@google.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@collabora.com
Subject: Re: [PATCH 6/8] usb: typec: fusb302: move gpio_int_n into function local scope
Date: Tue, 17 Nov 2026 14:24:48 +0100	[thread overview]
Message-ID: <avxVoLitepTkqAnE@black.igk.intel.com> (raw)
In-Reply-To: <20261113-fusb302-probe-cleanup-v1-6-e5c65a8c58c8@collabora.com>

On Fri, Nov 13, 2026 at 05:42:42PM +0100, Sebastian Reichel wrote:
> The driver only cares about the interrupt and the GPIO itself is
> device managed, so drop the reference from the device structure
> and only keep it in the function scope. While at it cleanup the
> error handling by using dev_err_probe.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/tcpm/fusb302.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
> index 1b3ee5715a74..76851e2b9ce5 100644
> --- a/drivers/usb/typec/tcpm/fusb302.c
> +++ b/drivers/usb/typec/tcpm/fusb302.c
> @@ -86,7 +86,6 @@ struct fusb302_chip {
>  	struct work_struct irq_work;
>  	bool irq_suspended;
>  	bool irq_while_suspended;
> -	struct gpio_desc *gpio_int_n;
>  	int gpio_int_n_irq;
>  	struct extcon_dev *extcon;
>  
> @@ -1646,19 +1645,17 @@ static void fusb302_irq_work(struct work_struct *work)
>  static int fusb302_init_irq(struct fusb302_chip *chip)
>  {
>  	struct device *dev = chip->dev;
> +	struct gpio_desc *int_gpio;
>  	int ret = 0;
>  
> -	chip->gpio_int_n = devm_gpiod_get(dev, "fcs,int_n", GPIOD_IN);
> -	if (IS_ERR(chip->gpio_int_n)) {
> -		dev_err(dev, "failed to request gpio_int_n\n");
> -		return PTR_ERR(chip->gpio_int_n);
> -	}
> -	ret = gpiod_to_irq(chip->gpio_int_n);
> -	if (ret < 0) {
> -		dev_err(dev,
> -			"cannot request IRQ for GPIO Int_N, ret=%d", ret);
> -		return ret;
> -	}
> +	int_gpio = devm_gpiod_get(dev, "fcs,int_n", GPIOD_IN);
> +	if (IS_ERR(int_gpio))
> +		return dev_err_probe(dev, PTR_ERR(int_gpio), "failed to request interrupt GPIO\n");
> +
> +	ret = gpiod_to_irq(int_gpio);
> +	if (ret < 0)
> +		return dev_err_probe(dev, ret, "cannot request IRQ for GPIO\n");
> +
>  	chip->gpio_int_n_irq = ret;
>  	return 0;
>  }
> 
> -- 
> 2.53.0
> 

-- 
heikki

  parent reply	other threads:[~2026-11-17 13:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 16:42 [PATCH 0/8] usb: typec: fusb302: cleanup device driver probe Sebastian Reichel
2026-11-13 16:42 ` [PATCH 1/8] usb: typec: tcpm: allocate pd_list entries non device managed Sebastian Reichel
2026-11-13 16:55   ` sashiko-bot
2026-11-13 16:42 ` [PATCH 2/8] usb: typec: tcpm: add device managed port registration Sebastian Reichel
2026-11-13 17:06   ` sashiko-bot
2026-11-13 16:42 ` [PATCH 3/8] usb: typec: fusb302: Switch to device managed resources Sebastian Reichel
2026-11-13 17:21   ` sashiko-bot
2026-11-13 16:42 ` [PATCH 4/8] usb: typec: fusb302: switch to devm_pm_set_wake_irq Sebastian Reichel
2026-11-13 17:34   ` sashiko-bot
2026-11-17 13:20   ` Heikki Krogerus
2026-11-13 16:42 ` [PATCH 5/8] usb: typec: fusb302: rename init_gpio into fusb302_init_irq Sebastian Reichel
2026-11-13 17:35   ` sashiko-bot
2026-11-17 13:23   ` Heikki Krogerus
2026-11-13 16:42 ` [PATCH 6/8] usb: typec: fusb302: move gpio_int_n into function local scope Sebastian Reichel
2026-11-13 17:36   ` sashiko-bot
2026-11-17 13:24   ` Heikki Krogerus [this message]
2026-11-17 13:37     ` Heikki Krogerus
2026-11-13 16:42 ` [PATCH 7/8] usb: typec: fusb302: rework gpio_int_n_irq handling Sebastian Reichel
2026-11-13 17:41   ` sashiko-bot
2026-11-17 13:35   ` Heikki Krogerus
2026-11-13 16:42 ` [PATCH 8/8] usb: typec: fusb302: drop custom gpio interrupt logic Sebastian Reichel
2026-11-13 17:51   ` sashiko-bot
2026-11-16  8:32 ` [PATCH 0/8] usb: typec: fusb302: cleanup device driver probe Chaoyi Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avxVoLitepTkqAnE@black.igk.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sebastian.reichel@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox