Skip to contentSkip to conversation

iio: ado: ad7192: Add error check and more debug log

PATCH Superseded Markus Burri 3 participants 4 messages Jun 13, 2023 – Jun 14, 2023

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: ado: ad7192: Add error check and more debug log

Print read and expected device ID as debug warning. Add error check for ad_sd_init() result.

---
 drivers/iio/adc/ad7192.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/iio/adc/ad7192.c +5 -3
index d71977b..220c3b7 100644
@@ -403,8 +403,8 @@ static int ad7192_setup(struct ad7192_state *st, struct device_node *np)
 	id &= AD7192_ID_MASK;
 
 	if (id != st->chip_info->chip_id)
-		dev_warn(&st->sd.spi->dev, "device ID query failed (0x%X)\n",
-			 id);
+		dev_warn(&st->sd.spi->dev, "device ID query failed (0x%X != 0x%X)\n",
+			 id, st->chip_info->chip_id);
 
 	st->mode = AD7192_MODE_SEL(AD7192_MODE_IDLE) |
 		AD7192_MODE_CLKSRC(st->clock_sel) |
@@ -1049,7 +1049,9 @@ static int ad7192_probe(struct spi_device *spi)
 	else
 		indio_dev->info = &ad7192_info;
 
-	ad_sd_init(&st->sd, indio_dev, spi, &ad7192_sigma_delta_info);
+	ret = ad_sd_init(&st->sd, indio_dev, spi, &ad7192_sigma_delta_info);
+	if (ret)
+		return ret;
 
 	ret = devm_ad_sd_setup_buffer_and_trigger(&spi->dev, indio_dev);
 	if (ret)
Signature · 1 line
2.39.2
Reviewed-by Nuno Sa on v1 1/1
#1 lore raw
Quoted 5 lines · Markus Burri

Print read and expected device ID as debug warning. Add error check for ad_sd_init() result.

---

You have unrelated changes but they are easy enough to go in same patch (at least for me). Hence:

Quoted 31 lines

 drivers/iio/adc/ad7192.c | 8 +++++---

 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/iio/adc/ad7192.c +0 -0
index d71977b..220c3b7 100644
@@ -403,8 +403,8 @@ static int ad7192_setup(struct ad7192_state *st, struct
 device_node *np)
         id &= AD7192_ID_MASK;


        if (id != st->chip_info->chip_id)
-               dev_warn(&st->sd.spi->dev, "device ID query failed (0x%X)\n", -                        id);
+               dev_warn(&st->sd.spi->dev, "device ID query failed (0x%X != 0x%X)\n",
+                        id, st->chip_info->chip_id);

        st->mode = AD7192_MODE_SEL(AD7192_MODE_IDLE) | AD7192_MODE_CLKSRC(st->clock_sel) |

drivers/iio/adc/ad7192.c +0 -0
@@ -1049,7 +1049,9 @@ static int ad7192_probe(struct spi_device *spi)

        else
                indio_dev->info = &ad7192_info;

-       ad_sd_init(&st->sd, indio_dev, spi, &ad7192_sigma_delta_info); +       ret = ad_sd_init(&st->sd, indio_dev, spi, &ad7192_sigma_delta_info); +       if (ret)
+               return ret;

        ret = devm_ad_sd_setup_buffer_and_trigger(&spi->dev, indio_dev); if (ret)

#2 lore raw
Quoted 10 lines · Nuno Sá
Quoted 5 lines · Markus Burri

Print read and expected device ID as debug warning. Add error check for ad_sd_init() result.

---

You have unrelated changes but they are easy enough to go in same patch (at least for me). Hence:

Actually, consider my tag valid after fixing the typo you have in the commit message...

Quoted 3 lines
maintainer
#3 lore raw
Quoted 8 lines · On Tue, 13 Jun 2023 10:46:30 +0200 Nuno Sá <[email protected]> wrote:
Quoted 7 lines · Nuno Sá
Quoted 5 lines · Markus Burri

Print read and expected device ID as debug warning. Add error check for ad_sd_init() result.

---

Quoted 7 lines
Quoted 3 lines

You have unrelated changes but they are easy enough to go in same patch (at least for me). Hence:

Actually, consider my tag valid after fixing the typo you have in the commit message...

This is also v2... So patch title should reflect that. (well v3 for next version with the typo fixed)

Quoted 4 lines
Quoted 3 lines