[PATCH] staging: iio: adc: ad7816: use dev_err_probe() for GPIO lookups

From: DelaySystem via B4 Relay

Date: Sun Nov 08 2026 - 00:13:47 EST


From: DelaySystem <DelaySystem@xxxxxxxxx>

GPIO lookups can return -EPROBE_DEFER. Convert the rdwr and convert
GPIO lookup failures in ad7816_probe() to dev_err_probe(), which
suppresses the error message on deferral and records the deferral
reason. The busy-GPIO path is left untouched: its optionality is the
subject of a separate proposed change.

No functional change other than defer handling.

Signed-off-by: DelaySystem <DelaySystem@xxxxxxxxx>
---
drivers/staging/iio/adc/ad7816.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 2a15d7598abb..11292216dfb5 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -381,20 +381,14 @@ static int ad7816_probe(struct spi_device *spi_dev)

chip->id = spi_get_device_id(spi_dev)->driver_data;
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;
- }
+ if (IS_ERR(chip->rdwr_pin))
+ return dev_err_probe(&spi_dev->dev, PTR_ERR(chip->rdwr_pin),
+ "Failed to request rdwr GPIO\n");
chip->convert_pin = devm_gpiod_get(&spi_dev->dev, "convert",
GPIOD_OUT_HIGH);
- 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(&spi_dev->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",
GPIOD_IN);

---
base-commit: fa4ad798f6f681031775266044ba1b0cf3c670bd
change-id: 20261107-batch1-s3-warn-289c98c7b118

Best regards,
--
DelaySystem <DelaySystem@xxxxxxxxx>