Commit a55e941
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>1 parent 91dc0c2 commit a55e941
1 file changed
Lines changed: 8 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | | - | |
13 | 14 | | |
14 | | - | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
202 | 203 | | |
203 | 204 | | |
204 | 205 | | |
205 | | - | |
| 206 | + | |
206 | 207 | | |
207 | 208 | | |
208 | | - | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
256 | 255 | | |
257 | 256 | | |
258 | 257 | | |
| |||
264 | 263 | | |
265 | 264 | | |
266 | 265 | | |
267 | | - | |
| 266 | + | |
268 | 267 | | |
269 | 268 | | |
270 | | - | |
271 | 269 | | |
272 | 270 | | |
273 | 271 | | |
| |||
0 commit comments