Re: [PATCH v3 09/12] iio: magnetometer: Remove redundant pm_runtime_mark_last_busy() calls

From: Jonathan Cameron
Date: Mon Aug 25 2025 - 11:16:30 EST


On Mon, 25 Aug 2025 16:53:58 +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().
>
> Also drop checking for errors on pm_runtime_put_autosuspend() in
> bmc150_magn_set_power_state().
>
> Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
> Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

One comment inline, but similar to the light sensors, I think it
still makes sense to take this patch now.

Applied

Thanks,

Jonathan

> diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c
> index 761daead5ada..6a73f6e2f1f0 100644
> --- a/drivers/iio/magnetometer/bmc150_magn.c
> +++ b/drivers/iio/magnetometer/bmc150_magn.c
> @@ -257,22 +257,17 @@ static int bmc150_magn_set_power_mode(struct bmc150_magn_data *data,
>
> static int bmc150_magn_set_power_state(struct bmc150_magn_data *data, bool on)
> {
This is another 'helper' that should probably go away in the longer term.

> -#ifdef CONFIG_PM
> - int ret;
> + int ret = 0;
>
> - if (on) {
> + if (on)
> ret = pm_runtime_resume_and_get(data->dev);
> - } else {
> - pm_runtime_mark_last_busy(data->dev);
> - ret = pm_runtime_put_autosuspend(data->dev);
> - }
> -
> + else
> + pm_runtime_put_autosuspend(data->dev);
> if (ret < 0) {
> dev_err(data->dev,
> "failed to change power state to %d\n", on);
> return ret;
> }
> -#endif
>
> return 0;
> }