Re: [PATCH v6 06/11] iio: adc: ti-ads1015: Remove ads1015_set_power_state()
From: Jonathan Cameron
Date: Sat Nov 14 2026 - 19:13:39 EST
On Mon, 9 Nov 2026 22:28:00 +0530
Archit Anant <architanant5@xxxxxxxxx> wrote:
> Remove the unnecessary ads1015_set_power_state() helper and
> use runtime PM helpers directly at the call sites.
>
> Use PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND() to manage the
> runtime PM reference in __ads1015_read_info_raw(), ensuring
> it is automatically released on function exit, including
> error paths.
>
> For event configuration and buffer operations, retain
> explicit reference management as the runtime PM reference
> must remain held beyond the lifetime of the respective
> function.
>
> Mark the device as last busy before putting it into
> autosuspend.
Glad you called this out as otherwise I might have not noticed.
See comment below. How this works changed a while back.
>
> Suggested-by: Jonathan Cameron <jic23@xxxxxxxxxx>
> Signed-off-by: Archit Anant <architanant5@xxxxxxxxx>
> static int ads1015_buffer_postdisable(struct iio_dev *indio_dev)
> {
> - return ads1015_set_power_state(iio_priv(indio_dev), false);
> + struct ads1015_data *data = iio_priv(indio_dev);
> + struct device *dev = regmap_get_device(data->regmap);
> +
> + pm_runtime_mark_last_busy(dev);
Take a look at what upstream pm_runtime_put_autosuspend() does.
> + pm_runtime_put_autosuspend(dev);
> +
> + return 0;
> }
>
> static const struct iio_buffer_setup_ops ads1015_buffer_setup_ops = {