* [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers
@ 2026-02-27 14:01 Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 01/12] iio: frequency: adrf6780: add dev variable Antoniu Miclaus
` (12 more replies)
0 siblings, 13 replies; 15+ messages in thread
From: Antoniu Miclaus @ 2026-02-27 14:01 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Antoniu Miclaus,
Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
Use dev_err_probe() consistently in the probe path of several ADI IIO
drivers. This simplifies error handling and ensures proper logging of
deferred probes.
Each driver is updated in two patches: first introducing a local
struct device *dev variable alongside the existing spi variable to
replace &spi->dev references in non-error paths, then converting
dev_err() error paths to use dev_err_probe().
Drivers updated:
- adrf6780
- admv1014
- admv1013
- adf4377
- ad7293
- admv8818
Changes in v4:
- Split each driver update back into two separate patches: one for
introducing the struct device variable and one for the dev_err_probe()
conversion. No lines are edited twice cross patch pairs, error-only
functions get dev introduced in the "use dev_err_probe" commit.
Antoniu Miclaus (12):
iio: frequency: adrf6780: add dev variable
iio: frequency: adrf6780: use dev_err_probe
iio: frequency: admv1014: add dev variable
iio: frequency: admv1014: use dev_err_probe
iio: frequency: admv1013: add dev variable
iio: frequency: admv1013: use dev_err_probe
iio: frequency: adf4377: add dev variable
iio: frequency: adf4377: use dev_err_probe
iio: dac: ad7293: add dev variable
iio: dac: ad7293: use dev_err_probe
iio: filter: admv8818: add dev variable
iio: filter: admv8818: use dev_err_probe
drivers/iio/dac/ad7293.c | 31 ++++++-----
drivers/iio/filter/admv8818.c | 56 +++++++++-----------
drivers/iio/frequency/adf4377.c | 56 ++++++++++----------
drivers/iio/frequency/admv1013.c | 43 +++++++--------
drivers/iio/frequency/admv1014.c | 89 ++++++++++++++------------------
drivers/iio/frequency/adrf6780.c | 60 +++++++++++----------
6 files changed, 155 insertions(+), 180 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 01/12] iio: frequency: adrf6780: add dev variable
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
@ 2026-02-27 14:01 ` Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 02/12] iio: frequency: adrf6780: use dev_err_probe Antoniu Miclaus
` (11 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Antoniu Miclaus @ 2026-02-27 14:01 UTC (permalink / raw)
To: Antoniu Miclaus, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
Introduce a local struct device pointer in functions that reference
&spi->dev for device-managed resource calls and device property reads,
improving code readability.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/frequency/adrf6780.c | 35 ++++++++++++++++----------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/drivers/iio/frequency/adrf6780.c b/drivers/iio/frequency/adrf6780.c
index a7a21f929970..1899995f7b20 100644
--- a/drivers/iio/frequency/adrf6780.c
+++ b/drivers/iio/frequency/adrf6780.c
@@ -426,18 +426,18 @@ static int adrf6780_init(struct adrf6780_state *st)
static void adrf6780_properties_parse(struct adrf6780_state *st)
{
- struct spi_device *spi = st->spi;
-
- st->vga_buff_en = device_property_read_bool(&spi->dev, "adi,vga-buff-en");
- st->lo_buff_en = device_property_read_bool(&spi->dev, "adi,lo-buff-en");
- st->if_mode_en = device_property_read_bool(&spi->dev, "adi,if-mode-en");
- st->iq_mode_en = device_property_read_bool(&spi->dev, "adi,iq-mode-en");
- st->lo_x2_en = device_property_read_bool(&spi->dev, "adi,lo-x2-en");
- st->lo_ppf_en = device_property_read_bool(&spi->dev, "adi,lo-ppf-en");
- st->lo_en = device_property_read_bool(&spi->dev, "adi,lo-en");
- st->uc_bias_en = device_property_read_bool(&spi->dev, "adi,uc-bias-en");
- st->lo_sideband = device_property_read_bool(&spi->dev, "adi,lo-sideband");
- st->vdet_out_en = device_property_read_bool(&spi->dev, "adi,vdet-out-en");
+ struct device *dev = &st->spi->dev;
+
+ st->vga_buff_en = device_property_read_bool(dev, "adi,vga-buff-en");
+ st->lo_buff_en = device_property_read_bool(dev, "adi,lo-buff-en");
+ st->if_mode_en = device_property_read_bool(dev, "adi,if-mode-en");
+ st->iq_mode_en = device_property_read_bool(dev, "adi,iq-mode-en");
+ st->lo_x2_en = device_property_read_bool(dev, "adi,lo-x2-en");
+ st->lo_ppf_en = device_property_read_bool(dev, "adi,lo-ppf-en");
+ st->lo_en = device_property_read_bool(dev, "adi,lo-en");
+ st->uc_bias_en = device_property_read_bool(dev, "adi,uc-bias-en");
+ st->lo_sideband = device_property_read_bool(dev, "adi,lo-sideband");
+ st->vdet_out_en = device_property_read_bool(dev, "adi,vdet-out-en");
}
static void adrf6780_powerdown(void *data)
@@ -450,9 +450,10 @@ static int adrf6780_probe(struct spi_device *spi)
{
struct iio_dev *indio_dev;
struct adrf6780_state *st;
+ struct device *dev = &spi->dev;
int ret;
- indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
+ indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
if (!indio_dev)
return -ENOMEM;
@@ -467,9 +468,9 @@ static int adrf6780_probe(struct spi_device *spi)
adrf6780_properties_parse(st);
- st->clkin = devm_clk_get_enabled(&spi->dev, "lo_in");
+ st->clkin = devm_clk_get_enabled(dev, "lo_in");
if (IS_ERR(st->clkin))
- return dev_err_probe(&spi->dev, PTR_ERR(st->clkin),
+ return dev_err_probe(dev, PTR_ERR(st->clkin),
"failed to get the LO input clock\n");
mutex_init(&st->lock);
@@ -478,11 +479,11 @@ static int adrf6780_probe(struct spi_device *spi)
if (ret)
return ret;
- ret = devm_add_action_or_reset(&spi->dev, adrf6780_powerdown, st);
+ ret = devm_add_action_or_reset(dev, adrf6780_powerdown, st);
if (ret)
return ret;
- return devm_iio_device_register(&spi->dev, indio_dev);
+ return devm_iio_device_register(dev, indio_dev);
}
static const struct spi_device_id adrf6780_id[] = {
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 02/12] iio: frequency: adrf6780: use dev_err_probe
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 01/12] iio: frequency: adrf6780: add dev variable Antoniu Miclaus
@ 2026-02-27 14:01 ` Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 03/12] iio: frequency: admv1014: add dev variable Antoniu Miclaus
` (10 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Antoniu Miclaus @ 2026-02-27 14:01 UTC (permalink / raw)
To: Antoniu Miclaus, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
Use dev_err_probe() consistently in the probe path to simplify error
handling and ensure deferred probes are logged correctly.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/frequency/adrf6780.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/drivers/iio/frequency/adrf6780.c b/drivers/iio/frequency/adrf6780.c
index 1899995f7b20..257fd31a0b0e 100644
--- a/drivers/iio/frequency/adrf6780.c
+++ b/drivers/iio/frequency/adrf6780.c
@@ -346,23 +346,21 @@ static const struct iio_chan_spec adrf6780_channels[] = {
static int adrf6780_reset(struct adrf6780_state *st)
{
int ret;
- struct spi_device *spi = st->spi;
+ struct device *dev = &st->spi->dev;
ret = __adrf6780_spi_update_bits(st, ADRF6780_REG_CONTROL,
ADRF6780_SOFT_RESET_MSK,
FIELD_PREP(ADRF6780_SOFT_RESET_MSK, 1));
- if (ret) {
- dev_err(&spi->dev, "ADRF6780 SPI software reset failed.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "ADRF6780 SPI software reset failed.\n");
ret = __adrf6780_spi_update_bits(st, ADRF6780_REG_CONTROL,
ADRF6780_SOFT_RESET_MSK,
FIELD_PREP(ADRF6780_SOFT_RESET_MSK, 0));
- if (ret) {
- dev_err(&spi->dev, "ADRF6780 SPI software reset disable failed.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "ADRF6780 SPI software reset disable failed.\n");
return 0;
}
@@ -371,7 +369,7 @@ static int adrf6780_init(struct adrf6780_state *st)
{
int ret;
unsigned int chip_id, enable_reg, enable_reg_msk;
- struct spi_device *spi = st->spi;
+ struct device *dev = &st->spi->dev;
/* Perform a software reset */
ret = adrf6780_reset(st);
@@ -383,10 +381,9 @@ static int adrf6780_init(struct adrf6780_state *st)
return ret;
chip_id = FIELD_GET(ADRF6780_CHIP_ID_MSK, chip_id);
- if (chip_id != ADRF6780_CHIP_ID) {
- dev_err(&spi->dev, "ADRF6780 Invalid Chip ID.\n");
- return -EINVAL;
- }
+ if (chip_id != ADRF6780_CHIP_ID)
+ return dev_err_probe(dev, -EINVAL,
+ "ADRF6780 Invalid Chip ID.\n");
enable_reg_msk = ADRF6780_VGA_BUFFER_EN_MSK |
ADRF6780_DETECTOR_EN_MSK |
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 03/12] iio: frequency: admv1014: add dev variable
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 01/12] iio: frequency: adrf6780: add dev variable Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 02/12] iio: frequency: adrf6780: use dev_err_probe Antoniu Miclaus
@ 2026-02-27 14:01 ` Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 04/12] iio: frequency: admv1014: use dev_err_probe Antoniu Miclaus
` (9 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Antoniu Miclaus @ 2026-02-27 14:01 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Antoniu Miclaus,
Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
Introduce a local struct device pointer in functions that reference
&spi->dev for device-managed resource calls and device property reads,
improving code readability.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/frequency/admv1014.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/drivers/iio/frequency/admv1014.c b/drivers/iio/frequency/admv1014.c
index 7a8f92ec80a2..f829c4595df3 100644
--- a/drivers/iio/frequency/admv1014.c
+++ b/drivers/iio/frequency/admv1014.c
@@ -610,6 +610,7 @@ static int admv1014_init(struct admv1014_state *st)
{
unsigned int chip_id, enable_reg, enable_reg_msk;
struct spi_device *spi = st->spi;
+ struct device *dev = &spi->dev;
int ret;
ret = regulator_bulk_enable(ADMV1014_NUM_REGULATORS, st->regulators);
@@ -618,7 +619,7 @@ static int admv1014_init(struct admv1014_state *st)
return ret;
}
- ret = devm_add_action_or_reset(&spi->dev, admv1014_reg_disable, st->regulators);
+ ret = devm_add_action_or_reset(dev, admv1014_reg_disable, st->regulators);
if (ret)
return ret;
@@ -626,16 +627,16 @@ static int admv1014_init(struct admv1014_state *st)
if (ret)
return ret;
- ret = devm_add_action_or_reset(&spi->dev, admv1014_clk_disable, st->clkin);
+ ret = devm_add_action_or_reset(dev, admv1014_clk_disable, st->clkin);
if (ret)
return ret;
st->nb.notifier_call = admv1014_freq_change;
- ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb);
+ ret = devm_clk_notifier_register(dev, st->clkin, &st->nb);
if (ret)
return ret;
- ret = devm_add_action_or_reset(&spi->dev, admv1014_powerdown, st);
+ ret = devm_add_action_or_reset(dev, admv1014_powerdown, st);
if (ret)
return ret;
@@ -712,13 +713,14 @@ static int admv1014_properties_parse(struct admv1014_state *st)
{
unsigned int i;
struct spi_device *spi = st->spi;
+ struct device *dev = &spi->dev;
int ret;
- st->det_en = device_property_read_bool(&spi->dev, "adi,detector-enable");
+ st->det_en = device_property_read_bool(dev, "adi,detector-enable");
- st->p1db_comp = device_property_read_bool(&spi->dev, "adi,p1db-compensation-enable");
+ st->p1db_comp = device_property_read_bool(dev, "adi,p1db-compensation-enable");
- ret = device_property_match_property_string(&spi->dev, "adi,input-mode",
+ ret = device_property_match_property_string(dev, "adi,input-mode",
input_mode_names,
ARRAY_SIZE(input_mode_names));
if (ret >= 0)
@@ -726,7 +728,7 @@ static int admv1014_properties_parse(struct admv1014_state *st)
else
st->input_mode = ADMV1014_IQ_MODE;
- ret = device_property_match_property_string(&spi->dev, "adi,quad-se-mode",
+ ret = device_property_match_property_string(dev, "adi,quad-se-mode",
quad_se_mode_names,
ARRAY_SIZE(quad_se_mode_names));
if (ret >= 0)
@@ -737,16 +739,16 @@ static int admv1014_properties_parse(struct admv1014_state *st)
for (i = 0; i < ADMV1014_NUM_REGULATORS; ++i)
st->regulators[i].supply = admv1014_reg_name[i];
- ret = devm_regulator_bulk_get(&st->spi->dev, ADMV1014_NUM_REGULATORS,
+ ret = devm_regulator_bulk_get(dev, ADMV1014_NUM_REGULATORS,
st->regulators);
if (ret) {
dev_err(&spi->dev, "Failed to request regulators");
return ret;
}
- st->clkin = devm_clk_get(&spi->dev, "lo_in");
+ st->clkin = devm_clk_get(dev, "lo_in");
if (IS_ERR(st->clkin))
- return dev_err_probe(&spi->dev, PTR_ERR(st->clkin),
+ return dev_err_probe(dev, PTR_ERR(st->clkin),
"failed to get the LO input clock\n");
return 0;
@@ -756,9 +758,10 @@ static int admv1014_probe(struct spi_device *spi)
{
struct iio_dev *indio_dev;
struct admv1014_state *st;
+ struct device *dev = &spi->dev;
int ret;
- indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
+ indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
if (!indio_dev)
return -ENOMEM;
@@ -787,7 +790,7 @@ static int admv1014_probe(struct spi_device *spi)
if (ret)
return ret;
- return devm_iio_device_register(&spi->dev, indio_dev);
+ return devm_iio_device_register(dev, indio_dev);
}
static const struct spi_device_id admv1014_id[] = {
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 04/12] iio: frequency: admv1014: use dev_err_probe
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
` (2 preceding siblings ...)
2026-02-27 14:01 ` [PATCH v4 03/12] iio: frequency: admv1014: add dev variable Antoniu Miclaus
@ 2026-02-27 14:01 ` Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 05/12] iio: frequency: admv1013: add dev variable Antoniu Miclaus
` (8 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Antoniu Miclaus @ 2026-02-27 14:01 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Antoniu Miclaus,
Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
Use dev_err_probe() consistently in the probe path to simplify error
handling and ensure deferred probes are logged correctly.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/frequency/admv1014.c | 60 +++++++++++++-------------------
1 file changed, 24 insertions(+), 36 deletions(-)
diff --git a/drivers/iio/frequency/admv1014.c b/drivers/iio/frequency/admv1014.c
index f829c4595df3..25e8cd8135ad 100644
--- a/drivers/iio/frequency/admv1014.c
+++ b/drivers/iio/frequency/admv1014.c
@@ -614,10 +614,8 @@ static int admv1014_init(struct admv1014_state *st)
int ret;
ret = regulator_bulk_enable(ADMV1014_NUM_REGULATORS, st->regulators);
- if (ret) {
- dev_err(&spi->dev, "Failed to enable regulators");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to enable regulators");
ret = devm_add_action_or_reset(dev, admv1014_reg_disable, st->regulators);
if (ret)
@@ -644,55 +642,47 @@ static int admv1014_init(struct admv1014_state *st)
ret = __admv1014_spi_update_bits(st, ADMV1014_REG_SPI_CONTROL,
ADMV1014_SPI_SOFT_RESET_MSK,
FIELD_PREP(ADMV1014_SPI_SOFT_RESET_MSK, 1));
- if (ret) {
- dev_err(&spi->dev, "ADMV1014 SPI software reset failed.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "ADMV1014 SPI software reset failed.\n");
ret = __admv1014_spi_update_bits(st, ADMV1014_REG_SPI_CONTROL,
ADMV1014_SPI_SOFT_RESET_MSK,
FIELD_PREP(ADMV1014_SPI_SOFT_RESET_MSK, 0));
- if (ret) {
- dev_err(&spi->dev, "ADMV1014 SPI software reset disable failed.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "ADMV1014 SPI software reset disable failed.\n");
ret = __admv1014_spi_write(st, ADMV1014_REG_VVA_TEMP_COMP, 0x727C);
- if (ret) {
- dev_err(&spi->dev, "Writing default Temperature Compensation value failed.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Writing default Temperature Compensation value failed.\n");
ret = __admv1014_spi_read(st, ADMV1014_REG_SPI_CONTROL, &chip_id);
if (ret)
return ret;
chip_id = FIELD_GET(ADMV1014_CHIP_ID_MSK, chip_id);
- if (chip_id != ADMV1014_CHIP_ID) {
- dev_err(&spi->dev, "Invalid Chip ID.\n");
- return -EINVAL;
- }
+ if (chip_id != ADMV1014_CHIP_ID)
+ return dev_err_probe(dev, -EINVAL, "Invalid Chip ID.\n");
ret = __admv1014_spi_update_bits(st, ADMV1014_REG_QUAD,
ADMV1014_QUAD_SE_MODE_MSK,
FIELD_PREP(ADMV1014_QUAD_SE_MODE_MSK,
st->quad_se_mode));
- if (ret) {
- dev_err(&spi->dev, "Writing Quad SE Mode failed.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Writing Quad SE Mode failed.\n");
ret = admv1014_update_quad_filters(st);
- if (ret) {
- dev_err(&spi->dev, "Update Quad Filters failed.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Update Quad Filters failed.\n");
ret = admv1014_update_vcm_settings(st);
- if (ret) {
- dev_err(&spi->dev, "Update VCM Settings failed.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Update VCM Settings failed.\n");
enable_reg_msk = ADMV1014_P1DB_COMPENSATION_MSK |
ADMV1014_IF_AMP_PD_MSK |
@@ -741,10 +731,8 @@ static int admv1014_properties_parse(struct admv1014_state *st)
ret = devm_regulator_bulk_get(dev, ADMV1014_NUM_REGULATORS,
st->regulators);
- if (ret) {
- dev_err(&spi->dev, "Failed to request regulators");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to request regulators");
st->clkin = devm_clk_get(dev, "lo_in");
if (IS_ERR(st->clkin))
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 05/12] iio: frequency: admv1013: add dev variable
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
` (3 preceding siblings ...)
2026-02-27 14:01 ` [PATCH v4 04/12] iio: frequency: admv1014: use dev_err_probe Antoniu Miclaus
@ 2026-02-27 14:01 ` Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 06/12] iio: frequency: admv1013: use dev_err_probe Antoniu Miclaus
` (7 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Antoniu Miclaus @ 2026-02-27 14:01 UTC (permalink / raw)
To: Antoniu Miclaus, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
Introduce a local struct device pointer in functions that reference
&spi->dev for device-managed resource calls and device property reads,
improving code readability.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/frequency/admv1013.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/iio/frequency/admv1013.c b/drivers/iio/frequency/admv1013.c
index d8e8d541990f..d29e288da011 100644
--- a/drivers/iio/frequency/admv1013.c
+++ b/drivers/iio/frequency/admv1013.c
@@ -518,11 +518,11 @@ static int admv1013_properties_parse(struct admv1013_state *st)
{
int ret;
const char *str;
- struct spi_device *spi = st->spi;
+ struct device *dev = &st->spi->dev;
- st->det_en = device_property_read_bool(&spi->dev, "adi,detector-enable");
+ st->det_en = device_property_read_bool(dev, "adi,detector-enable");
- ret = device_property_read_string(&spi->dev, "adi,input-mode", &str);
+ ret = device_property_read_string(dev, "adi,input-mode", &str);
if (ret)
st->input_mode = ADMV1013_IQ_MODE;
@@ -533,7 +533,7 @@ static int admv1013_properties_parse(struct admv1013_state *st)
else
return -EINVAL;
- ret = device_property_read_string(&spi->dev, "adi,quad-se-mode", &str);
+ ret = device_property_read_string(dev, "adi,quad-se-mode", &str);
if (ret)
st->quad_se_mode = ADMV1013_SE_MODE_DIFF;
@@ -546,11 +546,11 @@ static int admv1013_properties_parse(struct admv1013_state *st)
else
return -EINVAL;
- ret = devm_regulator_bulk_get_enable(&st->spi->dev,
+ ret = devm_regulator_bulk_get_enable(dev,
ARRAY_SIZE(admv1013_vcc_regs),
admv1013_vcc_regs);
if (ret) {
- dev_err_probe(&spi->dev, ret,
+ dev_err_probe(dev, ret,
"Failed to request VCC regulators\n");
return ret;
}
@@ -562,9 +562,10 @@ static int admv1013_probe(struct spi_device *spi)
{
struct iio_dev *indio_dev;
struct admv1013_state *st;
+ struct device *dev = &spi->dev;
int ret, vcm_uv;
- indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
+ indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
if (!indio_dev)
return -ENOMEM;
@@ -581,20 +582,20 @@ static int admv1013_probe(struct spi_device *spi)
if (ret)
return ret;
- ret = devm_regulator_get_enable_read_voltage(&spi->dev, "vcm");
+ ret = devm_regulator_get_enable_read_voltage(dev, "vcm");
if (ret < 0)
- return dev_err_probe(&spi->dev, ret,
+ return dev_err_probe(dev, ret,
"failed to get the common-mode voltage\n");
vcm_uv = ret;
- st->clkin = devm_clk_get_enabled(&spi->dev, "lo_in");
+ st->clkin = devm_clk_get_enabled(dev, "lo_in");
if (IS_ERR(st->clkin))
- return dev_err_probe(&spi->dev, PTR_ERR(st->clkin),
+ return dev_err_probe(dev, PTR_ERR(st->clkin),
"failed to get the LO input clock\n");
st->nb.notifier_call = admv1013_freq_change;
- ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb);
+ ret = devm_clk_notifier_register(dev, st->clkin, &st->nb);
if (ret)
return ret;
@@ -606,11 +607,11 @@ static int admv1013_probe(struct spi_device *spi)
return ret;
}
- ret = devm_add_action_or_reset(&spi->dev, admv1013_powerdown, st);
+ ret = devm_add_action_or_reset(dev, admv1013_powerdown, st);
if (ret)
return ret;
- return devm_iio_device_register(&spi->dev, indio_dev);
+ return devm_iio_device_register(dev, indio_dev);
}
static const struct spi_device_id admv1013_id[] = {
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 06/12] iio: frequency: admv1013: use dev_err_probe
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
` (4 preceding siblings ...)
2026-02-27 14:01 ` [PATCH v4 05/12] iio: frequency: admv1013: add dev variable Antoniu Miclaus
@ 2026-02-27 14:01 ` Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 07/12] iio: frequency: adf4377: add dev variable Antoniu Miclaus
` (6 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Antoniu Miclaus @ 2026-02-27 14:01 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Antoniu Miclaus,
Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
Use dev_err_probe() consistently in the probe path to simplify error
handling and ensure deferred probes are logged correctly.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/frequency/admv1013.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/frequency/admv1013.c b/drivers/iio/frequency/admv1013.c
index d29e288da011..9202443ef445 100644
--- a/drivers/iio/frequency/admv1013.c
+++ b/drivers/iio/frequency/admv1013.c
@@ -441,7 +441,7 @@ static int admv1013_init(struct admv1013_state *st, int vcm_uv)
{
int ret;
unsigned int data;
- struct spi_device *spi = st->spi;
+ struct device *dev = &st->spi->dev;
/* Perform a software reset */
ret = __admv1013_spi_update_bits(st, ADMV1013_REG_SPI_CONTROL,
@@ -461,10 +461,8 @@ static int admv1013_init(struct admv1013_state *st, int vcm_uv)
return ret;
data = FIELD_GET(ADMV1013_CHIP_ID_MSK, data);
- if (data != ADMV1013_CHIP_ID) {
- dev_err(&spi->dev, "Invalid Chip ID.\n");
- return -EINVAL;
- }
+ if (data != ADMV1013_CHIP_ID)
+ return dev_err_probe(dev, -EINVAL, "Invalid Chip ID.\n");
ret = __admv1013_spi_write(st, ADMV1013_REG_VVA_TEMP_COMP, 0xE700);
if (ret)
@@ -602,10 +600,8 @@ static int admv1013_probe(struct spi_device *spi)
mutex_init(&st->lock);
ret = admv1013_init(st, vcm_uv);
- if (ret) {
- dev_err(&spi->dev, "admv1013 init failed\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "admv1013 init failed\n");
ret = devm_add_action_or_reset(dev, admv1013_powerdown, st);
if (ret)
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 07/12] iio: frequency: adf4377: add dev variable
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
` (5 preceding siblings ...)
2026-02-27 14:01 ` [PATCH v4 06/12] iio: frequency: admv1013: use dev_err_probe Antoniu Miclaus
@ 2026-02-27 14:01 ` Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 08/12] iio: frequency: adf4377: use dev_err_probe Antoniu Miclaus
` (5 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Antoniu Miclaus @ 2026-02-27 14:01 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Antoniu Miclaus,
Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
Introduce a local struct device pointer in functions that reference
&spi->dev for device-managed resource calls and device property reads,
improving code readability.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/frequency/adf4377.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/drivers/iio/frequency/adf4377.c b/drivers/iio/frequency/adf4377.c
index fa686f785fa4..c2ae6f2012ce 100644
--- a/drivers/iio/frequency/adf4377.c
+++ b/drivers/iio/frequency/adf4377.c
@@ -882,35 +882,35 @@ static const struct iio_chan_spec adf4377_channels[] = {
static int adf4377_properties_parse(struct adf4377_state *st)
{
- struct spi_device *spi = st->spi;
+ struct device *dev = &st->spi->dev;
int ret;
- st->clkin = devm_clk_get_enabled(&spi->dev, "ref_in");
+ st->clkin = devm_clk_get_enabled(dev, "ref_in");
if (IS_ERR(st->clkin))
- return dev_err_probe(&spi->dev, PTR_ERR(st->clkin),
+ return dev_err_probe(dev, PTR_ERR(st->clkin),
"failed to get the reference input clock\n");
- st->gpio_ce = devm_gpiod_get_optional(&st->spi->dev, "chip-enable",
+ st->gpio_ce = devm_gpiod_get_optional(dev, "chip-enable",
GPIOD_OUT_LOW);
if (IS_ERR(st->gpio_ce))
- return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_ce),
+ return dev_err_probe(dev, PTR_ERR(st->gpio_ce),
"failed to get the CE GPIO\n");
- st->gpio_enclk1 = devm_gpiod_get_optional(&st->spi->dev, "clk1-enable",
+ st->gpio_enclk1 = devm_gpiod_get_optional(dev, "clk1-enable",
GPIOD_OUT_LOW);
if (IS_ERR(st->gpio_enclk1))
- return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_enclk1),
+ return dev_err_probe(dev, PTR_ERR(st->gpio_enclk1),
"failed to get the CE GPIO\n");
if (st->chip_info->has_gpio_enclk2) {
- st->gpio_enclk2 = devm_gpiod_get_optional(&st->spi->dev, "clk2-enable",
+ st->gpio_enclk2 = devm_gpiod_get_optional(dev, "clk2-enable",
GPIOD_OUT_LOW);
if (IS_ERR(st->gpio_enclk2))
- return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_enclk2),
+ return dev_err_probe(dev, PTR_ERR(st->gpio_enclk2),
"failed to get the CE GPIO\n");
}
- ret = device_property_match_property_string(&spi->dev, "adi,muxout-select",
+ ret = device_property_match_property_string(dev, "adi,muxout-select",
adf4377_muxout_modes,
ARRAY_SIZE(adf4377_muxout_modes));
if (ret >= 0)
@@ -1055,9 +1055,10 @@ static int adf4377_probe(struct spi_device *spi)
struct iio_dev *indio_dev;
struct regmap *regmap;
struct adf4377_state *st;
+ struct device *dev = &spi->dev;
int ret;
- indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
+ indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
if (!indio_dev)
return -ENOMEM;
@@ -1080,7 +1081,7 @@ static int adf4377_probe(struct spi_device *spi)
return ret;
st->nb.notifier_call = adf4377_freq_change;
- ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb);
+ ret = devm_clk_notifier_register(dev, st->clkin, &st->nb);
if (ret)
return ret;
@@ -1097,7 +1098,7 @@ static int adf4377_probe(struct spi_device *spi)
indio_dev->num_channels = ARRAY_SIZE(adf4377_channels);
}
- return devm_iio_device_register(&spi->dev, indio_dev);
+ return devm_iio_device_register(dev, indio_dev);
}
static const struct spi_device_id adf4377_id[] = {
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 08/12] iio: frequency: adf4377: use dev_err_probe
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
` (6 preceding siblings ...)
2026-02-27 14:01 ` [PATCH v4 07/12] iio: frequency: adf4377: add dev variable Antoniu Miclaus
@ 2026-02-27 14:01 ` Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 09/12] iio: dac: ad7293: add dev variable Antoniu Miclaus
` (4 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Antoniu Miclaus @ 2026-02-27 14:01 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Antoniu Miclaus,
Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
Use dev_err_probe() consistently in the probe path to simplify error
handling and ensure deferred probes are logged correctly.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/frequency/adf4377.c | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/drivers/iio/frequency/adf4377.c b/drivers/iio/frequency/adf4377.c
index c2ae6f2012ce..ce3a396624c3 100644
--- a/drivers/iio/frequency/adf4377.c
+++ b/drivers/iio/frequency/adf4377.c
@@ -706,23 +706,20 @@ static void adf4377_gpio_init(struct adf4377_state *st)
static int adf4377_init(struct adf4377_state *st)
{
- struct spi_device *spi = st->spi;
+ struct device *dev = &st->spi->dev;
int ret;
adf4377_gpio_init(st);
ret = adf4377_soft_reset(st);
- if (ret) {
- dev_err(&spi->dev, "Failed to soft reset.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to soft reset.\n");
ret = regmap_multi_reg_write(st->regmap, adf4377_reg_defaults,
ARRAY_SIZE(adf4377_reg_defaults));
- if (ret) {
- dev_err(&spi->dev, "Failed to set default registers.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to set default registers.\n");
ret = regmap_update_bits(st->regmap, 0x00,
ADF4377_0000_SDO_ACTIVE_MSK | ADF4377_0000_SDO_ACTIVE_R_MSK,
@@ -730,10 +727,9 @@ static int adf4377_init(struct adf4377_state *st)
ADF4377_0000_SDO_ACTIVE_SPI_4W) |
FIELD_PREP(ADF4377_0000_SDO_ACTIVE_R_MSK,
ADF4377_0000_SDO_ACTIVE_SPI_4W));
- if (ret) {
- dev_err(&spi->dev, "Failed to set 4-Wire Operation.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to set 4-Wire Operation.\n");
st->clkin_freq = clk_get_rate(st->clkin);
@@ -747,10 +743,9 @@ static int adf4377_init(struct adf4377_state *st)
FIELD_PREP(ADF4377_001A_PD_PFDCP_MSK, 0) |
FIELD_PREP(ADF4377_001A_PD_CLKOUT1_MSK, 0) |
FIELD_PREP(ADF4377_001A_PD_CLKOUT2_MSK, 0));
- if (ret) {
- dev_err(&spi->dev, "Failed to set power down registers.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to set power down registers.\n");
/* Set Mux Output */
ret = regmap_update_bits(st->regmap, 0x1D,
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 09/12] iio: dac: ad7293: add dev variable
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
` (7 preceding siblings ...)
2026-02-27 14:01 ` [PATCH v4 08/12] iio: frequency: adf4377: use dev_err_probe Antoniu Miclaus
@ 2026-02-27 14:01 ` Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 10/12] iio: dac: ad7293: use dev_err_probe Antoniu Miclaus
` (3 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Antoniu Miclaus @ 2026-02-27 14:01 UTC (permalink / raw)
To: Antoniu Miclaus, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
Introduce a local struct device pointer in functions that reference
&spi->dev for device-managed resource calls and device property reads,
improving code readability.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/dac/ad7293.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/iio/dac/ad7293.c b/drivers/iio/dac/ad7293.c
index c3797e40cdd9..c86c54d53df1 100644
--- a/drivers/iio/dac/ad7293.c
+++ b/drivers/iio/dac/ad7293.c
@@ -776,27 +776,27 @@ static int ad7293_reset(struct ad7293_state *st)
static int ad7293_properties_parse(struct ad7293_state *st)
{
- struct spi_device *spi = st->spi;
+ struct device *dev = &st->spi->dev;
int ret;
- ret = devm_regulator_get_enable(&spi->dev, "avdd");
+ ret = devm_regulator_get_enable(dev, "avdd");
if (ret)
- return dev_err_probe(&spi->dev, ret, "failed to enable AVDD\n");
+ return dev_err_probe(dev, ret, "failed to enable AVDD\n");
- ret = devm_regulator_get_enable(&spi->dev, "vdrive");
+ ret = devm_regulator_get_enable(dev, "vdrive");
if (ret)
- return dev_err_probe(&spi->dev, ret, "failed to enable VDRIVE\n");
+ return dev_err_probe(dev, ret, "failed to enable VDRIVE\n");
- ret = devm_regulator_get_enable_optional(&spi->dev, "vrefin");
+ ret = devm_regulator_get_enable_optional(dev, "vrefin");
if (ret < 0 && ret != -ENODEV)
- return dev_err_probe(&spi->dev, ret, "failed to enable VREFIN\n");
+ return dev_err_probe(dev, ret, "failed to enable VREFIN\n");
st->vrefin_en = ret != -ENODEV;
- st->gpio_reset = devm_gpiod_get_optional(&st->spi->dev, "reset",
+ st->gpio_reset = devm_gpiod_get_optional(dev, "reset",
GPIOD_OUT_HIGH);
if (IS_ERR(st->gpio_reset))
- return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_reset),
+ return dev_err_probe(dev, PTR_ERR(st->gpio_reset),
"failed to get the reset GPIO\n");
return 0;
@@ -845,9 +845,10 @@ static int ad7293_probe(struct spi_device *spi)
{
struct iio_dev *indio_dev;
struct ad7293_state *st;
+ struct device *dev = &spi->dev;
int ret;
- indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
+ indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
if (!indio_dev)
return -ENOMEM;
@@ -867,7 +868,7 @@ static int ad7293_probe(struct spi_device *spi)
if (ret)
return ret;
- return devm_iio_device_register(&spi->dev, indio_dev);
+ return devm_iio_device_register(dev, indio_dev);
}
static const struct spi_device_id ad7293_id[] = {
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 10/12] iio: dac: ad7293: use dev_err_probe
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
` (8 preceding siblings ...)
2026-02-27 14:01 ` [PATCH v4 09/12] iio: dac: ad7293: add dev variable Antoniu Miclaus
@ 2026-02-27 14:01 ` Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 11/12] iio: filter: admv8818: add dev variable Antoniu Miclaus
` (2 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Antoniu Miclaus @ 2026-02-27 14:01 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Antoniu Miclaus,
Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
Use dev_err_probe() consistently in the probe path to simplify error
handling and ensure deferred probes are logged correctly.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/dac/ad7293.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/dac/ad7293.c b/drivers/iio/dac/ad7293.c
index c86c54d53df1..df6f126abf05 100644
--- a/drivers/iio/dac/ad7293.c
+++ b/drivers/iio/dac/ad7293.c
@@ -806,7 +806,7 @@ static int ad7293_init(struct ad7293_state *st)
{
int ret;
u16 chip_id;
- struct spi_device *spi = st->spi;
+ struct device *dev = &st->spi->dev;
ret = ad7293_properties_parse(st);
if (ret)
@@ -821,10 +821,8 @@ static int ad7293_init(struct ad7293_state *st)
if (ret)
return ret;
- if (chip_id != AD7293_CHIP_ID) {
- dev_err(&spi->dev, "Invalid Chip ID.\n");
- return -EINVAL;
- }
+ if (chip_id != AD7293_CHIP_ID)
+ return dev_err_probe(dev, -EINVAL, "Invalid Chip ID.\n");
if (!st->vrefin_en)
return __ad7293_spi_update_bits(st, AD7293_REG_GENERAL,
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 11/12] iio: filter: admv8818: add dev variable
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
` (9 preceding siblings ...)
2026-02-27 14:01 ` [PATCH v4 10/12] iio: dac: ad7293: use dev_err_probe Antoniu Miclaus
@ 2026-02-27 14:01 ` Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 12/12] iio: filter: admv8818: use dev_err_probe Antoniu Miclaus
2026-02-27 15:03 ` [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Andy Shevchenko
12 siblings, 0 replies; 15+ messages in thread
From: Antoniu Miclaus @ 2026-02-27 14:01 UTC (permalink / raw)
To: Antoniu Miclaus, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
Introduce a local struct device pointer in functions that reference
&spi->dev for device-managed resource calls and device property reads,
improving code readability.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/filter/admv8818.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/iio/filter/admv8818.c b/drivers/iio/filter/admv8818.c
index 19f823446cda..5fafd71da2b3 100644
--- a/drivers/iio/filter/admv8818.c
+++ b/drivers/iio/filter/admv8818.c
@@ -701,12 +701,12 @@ static int admv8818_init(struct admv8818_state *st)
static int admv8818_clk_setup(struct admv8818_state *st)
{
- struct spi_device *spi = st->spi;
+ struct device *dev = &st->spi->dev;
int ret;
- st->clkin = devm_clk_get_optional(&spi->dev, "rf_in");
+ st->clkin = devm_clk_get_optional(dev, "rf_in");
if (IS_ERR(st->clkin))
- return dev_err_probe(&spi->dev, PTR_ERR(st->clkin),
+ return dev_err_probe(dev, PTR_ERR(st->clkin),
"failed to get the input clock\n");
else if (!st->clkin)
return 0;
@@ -715,7 +715,7 @@ static int admv8818_clk_setup(struct admv8818_state *st)
if (ret)
return ret;
- ret = devm_add_action_or_reset(&spi->dev, admv8818_clk_disable, st);
+ ret = devm_add_action_or_reset(dev, admv8818_clk_disable, st);
if (ret)
return ret;
@@ -724,16 +724,16 @@ static int admv8818_clk_setup(struct admv8818_state *st)
if (ret < 0)
return ret;
- return devm_add_action_or_reset(&spi->dev, admv8818_clk_notifier_unreg, st);
+ return devm_add_action_or_reset(dev, admv8818_clk_notifier_unreg, st);
}
static int admv8818_read_properties(struct admv8818_state *st)
{
- struct spi_device *spi = st->spi;
+ struct device *dev = &st->spi->dev;
u32 mhz;
int ret;
- ret = device_property_read_u32(&spi->dev, "adi,lpf-margin-mhz", &mhz);
+ ret = device_property_read_u32(dev, "adi,lpf-margin-mhz", &mhz);
if (ret == 0)
st->lpf_margin_hz = (u64)mhz * HZ_PER_MHZ;
else if (ret == -EINVAL)
@@ -742,7 +742,7 @@ static int admv8818_read_properties(struct admv8818_state *st)
return ret;
- ret = device_property_read_u32(&spi->dev, "adi,hpf-margin-mhz", &mhz);
+ ret = device_property_read_u32(dev, "adi,hpf-margin-mhz", &mhz);
if (ret == 0)
st->hpf_margin_hz = (u64)mhz * HZ_PER_MHZ;
else if (ret == -EINVAL)
@@ -758,9 +758,10 @@ static int admv8818_probe(struct spi_device *spi)
struct iio_dev *indio_dev;
struct regmap *regmap;
struct admv8818_state *st;
+ struct device *dev = &spi->dev;
int ret;
- indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
+ indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
if (!indio_dev)
return -ENOMEM;
@@ -792,7 +793,7 @@ static int admv8818_probe(struct spi_device *spi)
if (ret)
return ret;
- return devm_iio_device_register(&spi->dev, indio_dev);
+ return devm_iio_device_register(dev, indio_dev);
}
static const struct spi_device_id admv8818_id[] = {
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 12/12] iio: filter: admv8818: use dev_err_probe
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
` (10 preceding siblings ...)
2026-02-27 14:01 ` [PATCH v4 11/12] iio: filter: admv8818: add dev variable Antoniu Miclaus
@ 2026-02-27 14:01 ` Antoniu Miclaus
2026-02-27 15:03 ` [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Andy Shevchenko
12 siblings, 0 replies; 15+ messages in thread
From: Antoniu Miclaus @ 2026-02-27 14:01 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Antoniu Miclaus,
Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
Use dev_err_probe() consistently in the probe path to simplify error
handling and ensure deferred probes are logged correctly.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/filter/admv8818.c | 35 ++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)
diff --git a/drivers/iio/filter/admv8818.c b/drivers/iio/filter/admv8818.c
index 5fafd71da2b3..0b9e3ba55476 100644
--- a/drivers/iio/filter/admv8818.c
+++ b/drivers/iio/filter/admv8818.c
@@ -657,41 +657,34 @@ static void admv8818_clk_disable(void *data)
static int admv8818_init(struct admv8818_state *st)
{
int ret;
- struct spi_device *spi = st->spi;
+ struct device *dev = &st->spi->dev;
unsigned int chip_id;
ret = regmap_write(st->regmap, ADMV8818_REG_SPI_CONFIG_A,
ADMV8818_SOFTRESET_N_MSK | ADMV8818_SOFTRESET_MSK);
- if (ret) {
- dev_err(&spi->dev, "ADMV8818 Soft Reset failed.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "ADMV8818 Soft Reset failed.\n");
ret = regmap_write(st->regmap, ADMV8818_REG_SPI_CONFIG_A,
ADMV8818_SDOACTIVE_N_MSK | ADMV8818_SDOACTIVE_MSK);
- if (ret) {
- dev_err(&spi->dev, "ADMV8818 SDO Enable failed.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "ADMV8818 SDO Enable failed.\n");
ret = regmap_read(st->regmap, ADMV8818_REG_CHIPTYPE, &chip_id);
- if (ret) {
- dev_err(&spi->dev, "ADMV8818 Chip ID read failed.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "ADMV8818 Chip ID read failed.\n");
- if (chip_id != 0x1) {
- dev_err(&spi->dev, "ADMV8818 Invalid Chip ID.\n");
- return -EINVAL;
- }
+ if (chip_id != 0x1)
+ return dev_err_probe(dev, -EINVAL,
+ "ADMV8818 Invalid Chip ID.\n");
ret = regmap_update_bits(st->regmap, ADMV8818_REG_SPI_CONFIG_B,
ADMV8818_SINGLE_INSTRUCTION_MSK,
FIELD_PREP(ADMV8818_SINGLE_INSTRUCTION_MSK, 1));
- if (ret) {
- dev_err(&spi->dev, "ADMV8818 Single Instruction failed.\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "ADMV8818 Single Instruction failed.\n");
if (st->clkin)
return admv8818_rfin_band_select(st);
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
` (11 preceding siblings ...)
2026-02-27 14:01 ` [PATCH v4 12/12] iio: filter: admv8818: use dev_err_probe Antoniu Miclaus
@ 2026-02-27 15:03 ` Andy Shevchenko
2026-02-28 11:37 ` Jonathan Cameron
12 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2026-02-27 15:03 UTC (permalink / raw)
To: Antoniu Miclaus
Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
On Fri, Feb 27, 2026 at 04:01:29PM +0200, Antoniu Miclaus wrote:
> Use dev_err_probe() consistently in the probe path of several ADI IIO
> drivers. This simplifies error handling and ensures proper logging of
> deferred probes.
>
> Each driver is updated in two patches: first introducing a local
> struct device *dev variable alongside the existing spi variable to
> replace &spi->dev references in non-error paths, then converting
> dev_err() error paths to use dev_err_probe().
>
> Drivers updated:
> - adrf6780
> - admv1014
> - admv1013
> - adf4377
> - ad7293
> - admv8818
> Changes in v4:
> - Split each driver update back into two separate patches: one for
> introducing the struct device variable and one for the dev_err_probe()
> conversion. No lines are edited twice cross patch pairs, error-only
> functions get dev introduced in the "use dev_err_probe" commit.
Thanks, I briefly looked and it looks fine to me,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers
2026-02-27 15:03 ` [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Andy Shevchenko
@ 2026-02-28 11:37 ` Jonathan Cameron
0 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2026-02-28 11:37 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Antoniu Miclaus, Lars-Peter Clausen, Michael Hennerich,
David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
On Fri, 27 Feb 2026 17:03:44 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Fri, Feb 27, 2026 at 04:01:29PM +0200, Antoniu Miclaus wrote:
> > Use dev_err_probe() consistently in the probe path of several ADI IIO
> > drivers. This simplifies error handling and ensures proper logging of
> > deferred probes.
> >
> > Each driver is updated in two patches: first introducing a local
> > struct device *dev variable alongside the existing spi variable to
> > replace &spi->dev references in non-error paths, then converting
> > dev_err() error paths to use dev_err_probe().
> >
> > Drivers updated:
> > - adrf6780
> > - admv1014
> > - admv1013
> > - adf4377
> > - ad7293
> > - admv8818
>
> > Changes in v4:
> > - Split each driver update back into two separate patches: one for
> > introducing the struct device variable and one for the dev_err_probe()
> > conversion. No lines are edited twice cross patch pairs, error-only
> > functions get dev introduced in the "use dev_err_probe" commit.
>
> Thanks, I briefly looked and it looks fine to me,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Applied with a minor tweak to add () after dev_err_probe in the
the patch titles.
I like to encourage that way of indicating functions and don't want too many
patches not doing that in the tree. You had the () in the more detailed
descriptions so this is a really minor thing.
Thanks,
Jonathan
>
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-02-28 11:37 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 01/12] iio: frequency: adrf6780: add dev variable Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 02/12] iio: frequency: adrf6780: use dev_err_probe Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 03/12] iio: frequency: admv1014: add dev variable Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 04/12] iio: frequency: admv1014: use dev_err_probe Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 05/12] iio: frequency: admv1013: add dev variable Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 06/12] iio: frequency: admv1013: use dev_err_probe Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 07/12] iio: frequency: adf4377: add dev variable Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 08/12] iio: frequency: adf4377: use dev_err_probe Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 09/12] iio: dac: ad7293: add dev variable Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 10/12] iio: dac: ad7293: use dev_err_probe Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 11/12] iio: filter: admv8818: add dev variable Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 12/12] iio: filter: admv8818: use dev_err_probe Antoniu Miclaus
2026-02-27 15:03 ` [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Andy Shevchenko
2026-02-28 11:37 ` Jonathan Cameron
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®