Re: [PATCH 3/3] iio: adc: ti-ads1015: convert to fully managed resources

From: Andy Shevchenko

Date: Sat Jul 18 2026 - 04:39:32 EST


On Sat, Jul 18, 2026 at 01:20:16PM +0530, Archit Anant wrote:
> Refactor the driver to use devm_ allocations and power
> management, allowing for the complete removal of the
> ads1015_remove()
>
> Key changes:
> - Use devm_add_action_or_reset() to ensure the ADC is safely powered
> down upon driver removal.
> - Move to devm_pm_runtime_set_active_enabled() to manage the runtime
> PM lifecycle.
> - Update the PM operations to use DEFINE_RUNTIME_DEV_PM_OPS and
> pm_ptr() for modern compiler saftey.
> - Convert iio_device_register() and mutex_init() to their devm_
> variants.
> - Remove the thus obsolete ads1015_remove() function.

...

> +static void ads1015_power_off(void *data)
> +{
> + struct ads1015_data *st = data;

Unneeded.

> + /* power down single shot mode */
> + ads1015_set_conv_mode(st, ADS1015_SINGLESHOT);
> +}

/* power down single shot mode */
static void ads1015_power_off(void *st)
{
ads1015_set_conv_mode(st, ADS1015_SINGLESHOT);
}

...

> -static const struct dev_pm_ops ads1015_pm_ops = {
> - SET_RUNTIME_PM_OPS(ads1015_runtime_suspend,
> - ads1015_runtime_resume, NULL)
> -};
> +static DEFINE_RUNTIME_DEV_PM_OPS(ads1015_pm_ops,
> + ads1015_runtime_suspend,
> + ads1015_runtime_resume,
> + NULL);


> .driver = {
> .name = ADS1015_DRV_NAME,
> .of_match_table = ads1015_of_match,
> - .pm = &ads1015_pm_ops,
> + .pm = pm_ptr(&ads1015_pm_ops),
> },

This should be split to a separate change. Before even patch 1.

--
With Best Regards,
Andy Shevchenko