Re: [PATCH v2 3/5] iio: light: tcs3472: use devm for resource management
From: Andy Shevchenko
Date: Wed May 13 2026 - 07:05:48 EST
On Wed, May 13, 2026 at 12:32:13AM +0200, Aldo Conte wrote:
> Convert the driver to use device-managed resource allocation:
> - Add tcs3472_powerdown_action() and register it with
> devm_add_action_or_reset() to ensure the device is powered down on
> cleanup. Before this patch, the chip remained powered if probe
> failed after enabling it.
> - Replace iio_triggered_buffer_setup() with
> devm_iio_triggered_buffer_setup().
> - Replace request_threaded_irq() with devm_request_threaded_irq().
> - Replace iio_device_register() with devm_iio_device_register().
> - Remove tcs3472_remove() as all cleanup is now handled by devm.
>
> Rewrite the read-modify-write pattern in tcs3472_powerdown() and
> tcs3472_resume() so the new register value is computed first, written
> to the chip, and committed to data->enable only on success.
>
> Use a local 'dev = &client->dev' in tcs3472_probe() to keep the devm
> calls compact.
...
> Suggested-by: Andy Shevchenko <andy@xxxxxxxxxx>
In appropriate tag again.
...
> - dev_info(&client->dev, "TCS34723/34727 found\n");
> + dev_info(dev, "TCS34723/34727 found\n");
This is not part of devm conversion. You should not do two or more things in a
single patch — split!
--
With Best Regards,
Andy Shevchenko