[PATCH v4 3/3] iio: adc: at91_adc: convert to device-managed resources

Andy Shevchenko andriy.shevchenko at intel.com
Tue Nov 17 08:57:15 PST 2026


On Tue, Nov 17, 2026 at 04:05:10PM +0200, Abdelnasser Hussein wrote:
> Convert the driver to device-managed APIs so that all resources are
> freed automatically on probe failure and on driver detach:
> 
>   - allocate and register the IIO triggers directly in at91_adc_probe()
>     with devm_iio_trigger_alloc() and devm_iio_trigger_register(),
>     dropping at91_adc_allocate_trigger(), at91_adc_trigger_init() and
>     at91_adc_trigger_remove() along with their manual rollback paths
>   - set up the triggered buffer with devm_iio_triggered_buffer_setup()
>     directly in at91_adc_probe(), dropping at91_adc_buffer_init() and
>     at91_adc_buffer_remove()
>   - allocate the touchscreen input device with
>     devm_input_allocate_device(), dropping at91_ts_unregister() and the
>     manual input_free_device() error path in at91_ts_register()
>   - register the IIO device with devm_iio_device_register()
> 
> at91_adc_probe() no longer needs any error unwinding labels and
> at91_adc_remove() is removed together with the platform driver's
> .remove callback.

...

> static int at91_ts_register(struct iio_dev *idev,

The pdev is not used in this function, which suggests to use 'struct device
*dev' as a second parameter instead.

Please, make that change before this one in a separate patch.

-- 
With Best Regards,
Andy Shevchenko





More information about the linux-arm-kernel mailing list