On Wed, 9 Jul 2025 02:11:52 +0300 Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> wrote: > pm_runtime_put_autosuspend(), pm_runtime_put_sync_autosuspend(), > pm_runtime_autosuspend() and pm_request_autosuspend() now include a call > to pm_runtime_mark_last_busy(). Remove the now-reduntant explicit call to > pm_runtime_mark_last_busy(). > > Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> > Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx> Some comments for the future as more about what can be improved on the back of this than what you have here. > > diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c > index cc326f21d398..3a17b3898bf6 100644 > --- a/drivers/iio/adc/rcar-gyroadc.c > +++ b/drivers/iio/adc/rcar-gyroadc.c > @@ -163,12 +163,10 @@ static int rcar_gyroadc_set_power(struct rcar_gyroadc *priv, bool on) > { > struct device *dev = priv->dev; > This is a very clear example of where the *_set_power() pattern is a bad idea. There are two calls of this function, one with it hard coded as on and one with it hard coded as off. We can just push the pm_runtime_resume_and_get() to the on case etc. I don't mind that much if we do so as a follow up patch so this one can be the mechanical change and then we follow up with the enabled simplification. > - if (on) { > + if (on) > return pm_runtime_resume_and_get(dev); > - } else { > - pm_runtime_mark_last_busy(dev); > - return pm_runtime_put_autosuspend(dev); > - } > + > + return pm_runtime_put_autosuspend(dev); > } > > static int rcar_gyroadc_read_raw(struct iio_dev *indio_dev, >> diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c > index 48549d617e5f..f2a93c63ca14 100644 > --- a/drivers/iio/adc/ti-ads1015.c > +++ b/drivers/iio/adc/ti-ads1015.c > @@ -374,12 +374,10 @@ static int ads1015_set_power_state(struct ads1015_data *data, bool on) > int ret; > struct device *dev = regmap_get_device(data->regmap); > > - if (on) { > + if (on) > ret = pm_runtime_resume_and_get(dev); > - } else { > - pm_runtime_mark_last_busy(dev); > + else > ret = pm_runtime_put_autosuspend(dev); > - } > > return ret < 0 ? ret : 0; So this one has a stub version which only brings benefits because we have checks on the pm_runtime_put_autosuspend() path failing (which it does if we have !CONFIG_PM). I think the right option there is check the return value is < 0 for the resume_and_get() and don't check the _put_autosuspend() return value at all. Then we can just push this down to the call sites as all of them hard code the bool value. > }