]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
gpio: max732x: use guard(mutex) to simplify locking
authorRichard Lyu <richard.lyu@suse.com>
Wed, 11 Mar 2026 08:59:26 +0000 (16:59 +0800)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Mon, 16 Mar 2026 08:52:51 +0000 (09:52 +0100)
commit8a3613898ff3b7eb9eed252f41aebcc1d7af4a31
tree1e467561673cff8d2ae423745f1a1ea4ed112a8c
parent696e9ba9a3da3d919d08a1abf05c9288311858f1
gpio: max732x: use guard(mutex) to simplify locking

Convert the max732x driver to use the RAII-based guard(mutex) macro from
<linux/cleanup.h>. This change replaces manual mutex_lock() and
mutex_unlock() calls, allowing the chip lock to be managed automatically
based on function scope.

Refactor max732x_gpio_set_mask() and max732x_irq_update_mask() to
improve code readability. This allows for direct returns and removes
the redundant 'out' label in the set_mask function, resulting in
cleaner and more maintainable code.

While at it: order includes alphabetically and add missing ones.

Signed-off-by: Richard Lyu <richard.lyu@suse.com>
Link: https://patch.msgid.link/20260311085924.191288-1-richard.lyu@suse.com
[Bartosz: tweak commit message, add err.h and device.h to includes]
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpio-max732x.c