Re: [PATCH v4 3/3] iio: adc: at91_adc: convert to device-managed resources
From: Jonathan Cameron
Date: Sat Nov 21 2026 - 19:23:48 EST
On Tue, 17 Nov 2026 16:05:10 +0200
Abdelnasser Hussein <abdelnasserhussein11@xxxxxxxxx> 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.
>
> Suggested-by: Jonathan Cameron <jic23@xxxxxxxxxx>
> Signed-off-by: Abdelnasser Hussein <abdelnasserhussein11@xxxxxxxxx>
Looks good in general. Even better with the stuff Andy spotted that
would be nice to do whilst you are here!
Thanks,
Jonathan