From: Antoniu Miclaus <antoniu.miclaus@analog.com>
To: "Jorge Marques" <jorge.marques@analog.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Marcelo Schmitt" <marcelo.schmitt1@gmail.com>,
"Renato Lui Geh" <renatogeh@gmail.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Antoniu Miclaus <antoniu.miclaus@analog.com>
Subject: [PATCH 03/13] iio: adc: ad7780: use dev_err_probe
Date: Mon, 30 Mar 2026 14:18:46 +0300 [thread overview]
Message-ID: <20260330111856.121589-4-antoniu.miclaus@analog.com> (raw)
In-Reply-To: <20260330111856.121589-1-antoniu.miclaus@analog.com>
Use dev_err_probe() instead of dev_err() in the probe path to ensure
proper handling of deferred probing and to simplify error handling.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/adc/ad7780.c | 33 ++++++++++++---------------------
1 file changed, 12 insertions(+), 21 deletions(-)
diff --git a/drivers/iio/adc/ad7780.c b/drivers/iio/adc/ad7780.c
index 4c1990e27213..26382b1f8c9e 100644
--- a/drivers/iio/adc/ad7780.c
+++ b/drivers/iio/adc/ad7780.c
@@ -264,16 +264,12 @@ static const struct iio_info ad7780_info = {
static int ad7780_init_gpios(struct device *dev, struct ad7780_state *st)
{
- int ret;
-
st->powerdown_gpio = devm_gpiod_get_optional(dev,
"powerdown",
GPIOD_OUT_LOW);
- if (IS_ERR(st->powerdown_gpio)) {
- ret = PTR_ERR(st->powerdown_gpio);
- dev_err(dev, "Failed to request powerdown GPIO: %d\n", ret);
- return ret;
- }
+ if (IS_ERR(st->powerdown_gpio))
+ return dev_err_probe(dev, PTR_ERR(st->powerdown_gpio),
+ "Failed to request powerdown GPIO\n");
if (!st->chip_info->is_ad778x)
return 0;
@@ -282,20 +278,16 @@ static int ad7780_init_gpios(struct device *dev, struct ad7780_state *st)
st->gain_gpio = devm_gpiod_get_optional(dev,
"adi,gain",
GPIOD_OUT_HIGH);
- if (IS_ERR(st->gain_gpio)) {
- ret = PTR_ERR(st->gain_gpio);
- dev_err(dev, "Failed to request gain GPIO: %d\n", ret);
- return ret;
- }
+ if (IS_ERR(st->gain_gpio))
+ return dev_err_probe(dev, PTR_ERR(st->gain_gpio),
+ "Failed to request gain GPIO\n");
st->filter_gpio = devm_gpiod_get_optional(dev,
"adi,filter",
GPIOD_OUT_HIGH);
- if (IS_ERR(st->filter_gpio)) {
- ret = PTR_ERR(st->filter_gpio);
- dev_err(dev, "Failed to request filter GPIO: %d\n", ret);
- return ret;
- }
+ if (IS_ERR(st->filter_gpio))
+ return dev_err_probe(dev, PTR_ERR(st->filter_gpio),
+ "Failed to request filter GPIO\n");
return 0;
}
@@ -339,10 +331,9 @@ static int ad7780_probe(struct spi_device *spi)
return PTR_ERR(st->reg);
ret = regulator_enable(st->reg);
- if (ret) {
- dev_err(&spi->dev, "Failed to enable specified AVdd supply\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to enable specified AVdd supply\n");
ret = devm_add_action_or_reset(dev, ad7780_reg_disable, st->reg);
if (ret)
--
2.43.0
next prev parent reply other threads:[~2026-03-30 11:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 11:18 [PATCH 00/13] iio: adc: use dev_err_probe in probe paths Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 01/13] iio: adc: ad7949: use dev_err_probe Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 02/13] iio: adc: ad7780: add dev variable Antoniu Miclaus
2026-03-30 11:18 ` Antoniu Miclaus [this message]
2026-03-30 11:18 ` [PATCH 04/13] iio: adc: ad7793: " Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 05/13] iio: adc: ad7793: use dev_err_probe Antoniu Miclaus
2026-04-12 18:58 ` Jonathan Cameron
2026-03-30 11:18 ` [PATCH 06/13] iio: adc: ad7292: add dev variable Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 07/13] iio: adc: ad7292: use dev_err_probe Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 08/13] iio: adc: ad7791: add dev variable Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 09/13] iio: adc: ad7791: use dev_err_probe Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 10/13] iio: adc: ad7280a: " Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 11/13] iio: adc: ad7768-1: " Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 12/13] iio: adc: ad9467: " Antoniu Miclaus
2026-03-30 12:02 ` Tomas Melin
2026-03-30 11:18 ` [PATCH 13/13] iio: adc: ad4062: " Antoniu Miclaus
2026-04-12 19:02 ` [PATCH 00/13] iio: adc: use dev_err_probe in probe paths Jonathan Cameron
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=20260330111856.121589-4-antoniu.miclaus@analog.com \
--to=antoniu.miclaus@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=jorge.marques@analog.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt1@gmail.com \
--cc=nuno.sa@analog.com \
--cc=renatogeh@gmail.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®