]> git.ipfire.org Git - thirdparty/linux.git/commit
leds: lm3642: Use guard to simplify locking
authorRichard Lyu <richard.lyu@suse.com>
Fri, 20 Mar 2026 03:54:52 +0000 (11:54 +0800)
committerLee Jones <lee@kernel.org>
Thu, 26 Mar 2026 11:25:28 +0000 (11:25 +0000)
commita55e941e2283e931c8a292adc030c834f8ea0873
tree700a820b3d4b583cae07323309cc2de37982a734
parent91dc0c2a152373c4004df7e36de45190b82089ab
leds: lm3642: Use guard to simplify locking

The mutex_lock()/mutex_unlock() pattern requires explicitly pairing
lock and unlock calls. Use guard(mutex) instead so the lock is
automatically released when the scope exits.

Convert to guard(mutex) in lm3642_torch_brightness_set(),
lm3642_strobe_brightness_set(), and lm3642_indicator_brightness_set().
Add #include <linux/cleanup.h> to support scoped guards.

Signed-off-by: Richard Lyu <richard.lyu@suse.com>
Link: https://patch.msgid.link/20260320035451.31071-1-richard.lyu@suse.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/leds-lm3642.c