]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: dac: ds4424: ratelimit read errors and use device context
authorOleksij Rempel <o.rempel@pengutronix.de>
Tue, 10 Feb 2026 13:51:00 +0000 (14:51 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 22 Mar 2026 12:38:30 +0000 (12:38 +0000)
Replace pr_err() with dev_err_ratelimited() in the RAW read path to avoid
log spam on repeated I2C failures and to include the device context.

Use %pe to print errno names for faster debugging. Use the parent
device context to identify the physical hardware causing the error.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/dac/ds4424.c

index c15eb7b5eb96017f98334c65e4bd72c094b5e2a5..9d33a810336f78f8835a6ae74bc4f294870a9eb8 100644 (file)
@@ -99,8 +99,9 @@ static int ds4424_read_raw(struct iio_dev *indio_dev,
        case IIO_CHAN_INFO_RAW:
                ret = ds4424_get_value(indio_dev, &regval, chan->channel);
                if (ret < 0) {
-                       pr_err("%s : ds4424_get_value returned %d\n",
-                                                       __func__, ret);
+                       dev_err_ratelimited(indio_dev->dev.parent,
+                                           "Failed to read channel %d: %pe\n",
+                                           chan->channel, ERR_PTR(ret));
                        return ret;
                }