[PATCH v2 11/17] iio: gyro: fxas21002c: Discard pm_runtime_put_autosuspend() return values

From: Brian Norris

Date: Wed Oct 21 2026 - 20:05:26 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, and inline the helpers now
that they're even more trivial.

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
* Inlining

drivers/iio/gyro/fxas21002c_core.c | 33 ++++++++----------------------
1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/drivers/iio/gyro/fxas21002c_core.c b/drivers/iio/gyro/fxas21002c_core.c
index a88670207cec..1d891387b121 100644
--- a/drivers/iio/gyro/fxas21002c_core.c
+++ b/drivers/iio/gyro/fxas21002c_core.c
@@ -364,18 +364,6 @@ static int fxas21002c_write(struct fxas21002c_data *data,
return ret;
}

-static int fxas21002c_pm_get(struct fxas21002c_data *data)
-{
- return pm_runtime_resume_and_get(regmap_get_device(data->regmap));
-}
-
-static int fxas21002c_pm_put(struct fxas21002c_data *data)
-{
- struct device *dev = regmap_get_device(data->regmap);
-
- return pm_runtime_put_autosuspend(dev);
-}
-
static int fxas21002c_temp_get(struct fxas21002c_data *data, int *val)
{
struct device *dev = regmap_get_device(data->regmap);
@@ -383,22 +371,20 @@ static int fxas21002c_temp_get(struct fxas21002c_data *data, int *val)
int ret;

mutex_lock(&data->lock);
- ret = fxas21002c_pm_get(data);
+ ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
goto data_unlock;

ret = regmap_field_read(data->regmap_fields[F_TEMP], &temp);
if (ret < 0) {
dev_err(dev, "failed to read temp: %d\n", ret);
- fxas21002c_pm_put(data);
+ pm_runtime_put_autosuspend(dev);
goto data_unlock;
}

*val = sign_extend32(temp, 7);

- ret = fxas21002c_pm_put(data);
- if (ret < 0)
- goto data_unlock;
+ pm_runtime_put_autosuspend(dev);

ret = IIO_VAL_INT;

@@ -416,7 +402,7 @@ static int fxas21002c_axis_get(struct fxas21002c_data *data,
int ret;

mutex_lock(&data->lock);
- ret = fxas21002c_pm_get(data);
+ ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
goto data_unlock;

@@ -424,15 +410,13 @@ static int fxas21002c_axis_get(struct fxas21002c_data *data,
&axis_be, sizeof(axis_be));
if (ret < 0) {
dev_err(dev, "failed to read axis: %d: %d\n", index, ret);
- fxas21002c_pm_put(data);
+ pm_runtime_put_autosuspend(dev);
goto data_unlock;
}

*val = sign_extend32(be16_to_cpu(axis_be), 15);

- ret = fxas21002c_pm_put(data);
- if (ret < 0)
- goto data_unlock;
+ pm_runtime_put_autosuspend(dev);

ret = IIO_VAL_INT;

@@ -725,10 +709,11 @@ static irqreturn_t fxas21002c_trigger_handler(int irq, void *p)
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct fxas21002c_data *data = iio_priv(indio_dev);
+ struct device *dev = regmap_get_device(data->regmap);
int ret;

mutex_lock(&data->lock);
- ret = fxas21002c_pm_get(data);
+ ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
goto out_unlock;

@@ -741,7 +726,7 @@ static irqreturn_t fxas21002c_trigger_handler(int irq, void *p)
data->timestamp);

out_pm_put:
- fxas21002c_pm_put(data);
+ pm_runtime_put_autosuspend(dev);

out_unlock:
mutex_unlock(&data->lock);
--
2.56.0.218.g1ec904b173-goog