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

Jonathan Cameron jic23 at kernel.org
Mon Aug 25 15:15:52 UTC 2025


On Mon, 25 Aug 2025 16:53:58 +0300
Sakari Ailus <sakari.ailus at linux.intel.com> 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 at linux.intel.com>
> Reviewed-by: Linus Walleij <linus.walleij at linaro.org>

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;
>  }



More information about the Linux-stm32 mailing list