Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: ff-memless - convert locking to guard notation

Use guard() notation instead of explicitly acquiring and releasing
spinlocks to simplify the code and ensure that all locks are released.

Link: https://lore.kernel.org/r/20241107071538.195340-4-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+2 -6
+2 -6
drivers/input/ff-memless.c
··· 401 401 { 402 402 struct ml_device *ml = from_timer(ml, t, timer); 403 403 struct input_dev *dev = ml->dev; 404 - unsigned long flags; 405 404 406 405 pr_debug("timer: updating effects\n"); 407 406 408 - spin_lock_irqsave(&dev->event_lock, flags); 407 + guard(spinlock_irqsave)(&dev->event_lock); 409 408 ml_play_effects(ml); 410 - spin_unlock_irqrestore(&dev->event_lock, flags); 411 409 } 412 410 413 411 /* ··· 463 465 struct ml_device *ml = dev->ff->private; 464 466 struct ml_effect_state *state = &ml->states[effect->id]; 465 467 466 - spin_lock_irq(&dev->event_lock); 468 + guard(spinlock_irq)(&dev->event_lock); 467 469 468 470 if (test_bit(FF_EFFECT_STARTED, &state->flags)) { 469 471 __clear_bit(FF_EFFECT_PLAYING, &state->flags); ··· 474 476 state->adj_at = state->play_at; 475 477 ml_schedule_timer(ml); 476 478 } 477 - 478 - spin_unlock_irq(&dev->event_lock); 479 479 480 480 return 0; 481 481 }