Re: [PATCH v6] iio: imu: kmx61: Use guard(mutex)() over manual locking
From: Andy Shevchenko
Date: Wed May 13 2026 - 10:14:17 EST
On Tue, May 12, 2026 at 09:06:54PM -0500, Maxwell Doose wrote:
> Include linux/cleanup.h to take advantage of new macros.
>
> Replace manual mutex_lock() and mutex_unlock() calls across the file
> with guard(mutex)() and scoped_guard() where appropriate to simplify
> error paths and eliminate manual locking calls.
>
> Add new helper function kmx61_read_for_each_active_channel() to mitigate
> certain style issues and to prevent notifying that the IRQ is finished
> whilst holding the lock.
>
> Update certain returns, and add default case to return -EINVAL in
> kmx61_read_raw().
>
> Remove now-redundant gotos and ret variables, as the new RAII macros
> make them unneeded.
Have you used --histogram algo when prepared patch? Please, do it, if
not yet. It might improve the diff itself and hence makes reviewers a bit
more happier.
--
With Best Regards,
Andy Shevchenko