Re: [PATCH v2 2/5] iio: light: tcs3472: convert remaining locking to guard(mutex)
From: Andy Shevchenko
Date: Wed May 13 2026 - 06:58:40 EST
On Wed, May 13, 2026 at 12:32:12AM +0200, Aldo Conte wrote:
> Convert the locking in tcs3472_read_event(), tcs3472_write_event(),
> tcs3472_read_event_config(), tcs3472_write_event_config(),
> tcs3472_powerdown() and tcs3472_resume() to use guard(mutex)
> instead of explicit mutex_lock()/mutex_unlock() pairs.
>
> This avoids manual unlock calls on each return path, drops the goto
> in tcs3472_write_event(), and removes 'ret' variables only needed to
> return after the unlock.
>
> No functional change.
...
> Suggested-by: Andy Shevchenko <andy@xxxxxxxxxx>
Not appropriate tag, I suggested only changes (as you pointed out below) to
your idea and initial contribution.
> ---
> v2:
> (Suggested by Andy)
> - Moved earlier in the series to avoid introducing manual locking in the devm
> patch that would then be converted here.
> - Dropped "found by code inspection" (this is a cleanup, not a bug)
> - Test details moved to cover letter
...
Code wise LGTM.
--
With Best Regards,
Andy Shevchenko