mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: DelaySystem@tubot.lat
Cc: andy@kernel.org, nuno.sa@analog.com, gregkh@linuxfoundation.org,
	dlechner@baylibre.com, jic23@kernel.org,
	Michael.Hennerich@analog.com, linux-staging@lists.linux.dev,
	krzk@kernel.org, crofts@kernel.org, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org, linux@analog.com
Subject: Re: [PATCH v4] staging: iio: adc: ad7816: use dev_err_probe() for GPIO lookups
Date: Tue, 24 Nov 2026 09:50:18 +0200	[thread overview]
Message-ID: <awVBui6dpNyD-4ps@ashevche-desk.local> (raw)
In-Reply-To: <20261123-batch1-s3-warn-v4-1-47cd8d7d4ce9@tubot.lat>

On Mon, Nov 23, 2026 at 01:47:16PM -0800, Maximo Manriquez Lizarraga via B4 Relay wrote:
> 
> GPIO lookups can return -EPROBE_DEFER.  Convert the rdwr, convert,
> and busy GPIO lookup failures in ad7816_probe() to dev_err_probe(),
> which suppresses the error message on deferral and records the deferral
> reason.
> 
> No functional change other than defer handling.

...

> static int ad7816_probe(struct spi_device *spi_dev)
>  {
>  	struct ad7816_chip_info *chip;
>  	struct iio_dev *indio_dev;
> +	struct device *dev = &spi_dev->dev;
>  	int i, ret;

Preserve reversed xmas tree order.

...

> -	chip->rdwr_pin = devm_gpiod_get(&spi_dev->dev, "rdwr", GPIOD_OUT_HIGH);
> -	if (IS_ERR(chip->rdwr_pin)) {
> -		ret = PTR_ERR(chip->rdwr_pin);
> -		dev_err(&spi_dev->dev, "Failed to request rdwr GPIO: %d\n",
> -			ret);
> -		return ret;
> -	}
> -	chip->convert_pin = devm_gpiod_get(&spi_dev->dev, "convert",
> +	chip->rdwr_pin = devm_gpiod_get(dev, "rdwr", GPIOD_OUT_HIGH);
> +	if (IS_ERR(chip->rdwr_pin))
> +		return dev_err_probe(dev, PTR_ERR(chip->rdwr_pin),
> +				     "Failed to request rdwr GPIO\n");

> +	chip->convert_pin = devm_gpiod_get(dev, "convert",
>  					   GPIOD_OUT_HIGH);

It's perfectly a single line now. BUT... Do not touch lines that are not
modified after the main subject, id est moving to dev_err_probe().

> -	if (IS_ERR(chip->convert_pin)) {
> -		ret = PTR_ERR(chip->convert_pin);
> -		dev_err(&spi_dev->dev, "Failed to request convert GPIO: %d\n",
> -			ret);
> -		return ret;
> -	}
> +	if (IS_ERR(chip->convert_pin))
> +		return dev_err_probe(dev, PTR_ERR(chip->convert_pin),
> +				     "Failed to request convert GPIO\n");
>  	if (chip->id == ID_AD7816 || chip->id == ID_AD7817) {
> -		chip->busy_pin = devm_gpiod_get(&spi_dev->dev, "busy",
> +		chip->busy_pin = devm_gpiod_get(dev, "busy",
>  						GPIOD_IN);

Ditto. It's one line now, but it doesn't belong to this patch.

> -		if (IS_ERR(chip->busy_pin)) {
> -			ret = PTR_ERR(chip->busy_pin);
> -			dev_err(&spi_dev->dev, "Failed to request busy GPIO: %d\n",
> -				ret);
> -			return ret;
> -		}
> +		if (IS_ERR(chip->busy_pin))
> +			return dev_err_probe(dev, PTR_ERR(chip->busy_pin),
> +					     "Failed to request busy GPIO\n");
>  	}

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2026-11-24  7:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 21:47 Maximo Manriquez Lizarraga via B4 Relay
2026-11-24  7:50 ` Andy Shevchenko [this message]

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=awVBui6dpNyD-4ps@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=DelaySystem@tubot.lat \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=crofts@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux@analog.com \
    --cc=nuno.sa@analog.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

all inboxes | Powered by JetHome®