Re: [PATCH v8 0/5] iio: adc: ad799x: modernize resource management
From: Andy Shevchenko
Date: Tue Apr 14 2026 - 13:17:37 EST
On Sun, Apr 12, 2026 at 03:07:34PM +0530, Archit Anant wrote:
> This series modernizes the ad799x driver by converting resource
> management to the devm_ infrastructure. This results in cleaner
> probe error handling, the removal of the ad799x_remove() function,
> and improved overall code maintainability and safety.
>
> Key changes in this series include:
> - A prerequisite cleanup to sort headers alphabetically.
> - Static allocation of the rx_buf using IIO_DECLARE_BUFFER_WITH_TS()
> to avoid dynamic memory leaks during scan mode updates.
> - Caching of VCC and VREF regulator voltages during probe() to
> optimize read_raw() performance and simplify power management logic.
> - Migration of regulators and mutex initialization to device-managed
> resources (devm).
> - Fixing a potential race condition by moving mutex initialization
> before IRQ registration.
> - Removal of the manual ad799x_remove() function and all goto-based
> error cleanup labels in ad799x_probe().
>
> These changes ensure the teardown sequence is always correct,
> following the reverse order of allocation, and remove unnecessary
> boilerplate code from the driver.
Some pieces still can be polished, but this is good enough, let's go with it!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
--
With Best Regards,
Andy Shevchenko