[PATCH v2 16/17] iio: light: tsl2583: Discard pm_runtime_put_autosuspend() return values
From: Brian Norris
Date: Wed Oct 21 2026 - 20:05:35 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/tsl2583.c | 27 ++++-----------------------
1 file changed, 4 insertions(+), 23 deletions(-)
diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
index 2d041b7530e6..a5b2b7fb6dd9 100644
--- a/drivers/iio/light/tsl2583.c
+++ b/drivers/iio/light/tsl2583.c
@@ -647,7 +647,7 @@ static int tsl2583_read_raw(struct iio_dev *indio_dev,
int *val, int *val2, long mask)
{
struct tsl2583_chip *chip = iio_priv(indio_dev);
- int ret, pm_ret;
+ int ret;
ret = pm_runtime_resume_and_get(&chip->client->dev);
if (ret < 0)
@@ -716,19 +716,7 @@ static int tsl2583_read_raw(struct iio_dev *indio_dev,
read_done:
mutex_unlock(&chip->als_mutex);
- if (ret < 0) {
- pm_runtime_put_autosuspend(&chip->client->dev);
- return ret;
- }
-
- /*
- * Preserve the ret variable if the call to
- * pm_runtime_put_autosuspend() is successful so the reading
- * (if applicable) is returned to user space.
- */
- pm_ret = pm_runtime_put_autosuspend(&chip->client->dev);
- if (pm_ret < 0)
- return pm_ret;
+ pm_runtime_put_autosuspend(&chip->client->dev);
return ret;
}
@@ -780,16 +768,9 @@ static int tsl2583_write_raw(struct iio_dev *indio_dev,
mutex_unlock(&chip->als_mutex);
- if (ret < 0) {
- pm_runtime_put_autosuspend(&chip->client->dev);
- return ret;
- }
+ pm_runtime_put_autosuspend(&chip->client->dev);
- ret = pm_runtime_put_autosuspend(&chip->client->dev);
- if (ret < 0)
- return ret;
-
- return 0;
+ return ret;
}
static const struct iio_info tsl2583_info = {
--
2.56.0.218.g1ec904b173-goog