[PATCH v2 17/17] iio: light: us5182d: Discard pm_runtime_put_autosuspend() return values

From: Brian Norris

Date: Wed Oct 21 2026 - 20:10:52 EST


This driver propagates the return value of pm_runtime_put_autosuspend(),
which is not particularly useful.

Returning an error code from pm_runtime_put_autosuspend() merely means
that it has not queued up a timer or work item to check whether or not
the device can be suspended and there are many perfectly valid
situations in which that can happen, like after writing "on" to the
device's runtime PM "control" attribute in sysfs for one example.

For this reason, modify this driver to simply discard the
pm_runtime_put_autosuspend() return value.

This will facilitate a planned change of the
pm_runtime_put_autosuspend() return type to void in the future, similar
to commit 3afd8df02433 ("PM: runtime: Change pm_runtime_put() return
type to void").

Signed-off-by: Brian Norris <briannorris@xxxxxxxxxxxx>
---

Changes in v2:
* Split iio patch into per-driver patches

drivers/iio/light/us5182d.c | 32 ++++++++++----------------------
1 file changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c
index ab518311fd79..98279bd1ab25 100644
--- a/drivers/iio/light/us5182d.c
+++ b/drivers/iio/light/us5182d.c
@@ -366,45 +366,36 @@ static int us5182d_set_power_state(struct us5182d_data *data, bool on)
if (on)
return pm_runtime_resume_and_get(&data->client->dev);

- return pm_runtime_put_autosuspend(&data->client->dev);
+ pm_runtime_put_autosuspend(&data->client->dev);
+
+ return 0;
}

static int us5182d_read_value(struct us5182d_data *data,
struct iio_chan_spec const *chan)
{
- int ret, value;
+ int ret;

mutex_lock(&data->lock);

if (data->power_mode == US5182D_ONESHOT) {
ret = us5182d_oneshot_en(data);
if (ret < 0)
- goto out_err;
+ goto out;
}

ret = us5182d_set_power_state(data, true);
if (ret < 0)
- goto out_err;
+ goto out;

if (chan->type == IIO_LIGHT)
ret = us5182d_get_als(data);
else
ret = us5182d_get_px(data);
- if (ret < 0)
- goto out_poweroff;
-
- value = ret;

- ret = us5182d_set_power_state(data, false);
- if (ret < 0)
- goto out_err;
-
- mutex_unlock(&data->lock);
- return value;
-
-out_poweroff:
us5182d_set_power_state(data, false);
-out_err:
+
+out:
mutex_unlock(&data->lock);
return ret;
}
@@ -676,11 +667,8 @@ static int us5182d_write_event_config(struct iio_dev *indio_dev,
goto err;
}

- if (!state) {
- ret = us5182d_set_power_state(data, false);
- if (ret < 0)
- goto err;
- }
+ if (!state)
+ us5182d_set_power_state(data, false);

if (!data->falling_en && !data->rising_en && !data->default_continuous)
data->power_mode = US5182D_ONESHOT;
--
2.56.0.218.g1ec904b173-goog