]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: imu: kmx61: Use guard(mutex)() over manual locking
authorMaxwell Doose <m32285159@gmail.com>
Thu, 21 May 2026 22:30:43 +0000 (17:30 -0500)
committerJonathan Cameron <jic23@kernel.org>
Sun, 31 May 2026 10:01:47 +0000 (11:01 +0100)
commitf9242e31d16dec9958d0b65d8071823e2efdd9f6
treee058c31f35eb2160f8944adbe237af27666f0928
parentf9f99197a88260046b56cf4d24e51aff849bd45b
iio: imu: kmx61: Use guard(mutex)() over manual locking

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.

Signed-off-by: Maxwell Doose <m32285159@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/imu/kmx61.c