Skip to content

Commit 4e3929c

Browse files
committed
Input: mt - 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-6-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 96173d6 commit 4e3929c

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

drivers/input/input-mt.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,10 @@ void input_mt_drop_unused(struct input_dev *dev)
285285
struct input_mt *mt = dev->mt;
286286

287287
if (mt) {
288-
unsigned long flags;
289-
290-
spin_lock_irqsave(&dev->event_lock, flags);
288+
guard(spinlock_irqsave)(&dev->event_lock);
291289

292290
__input_mt_drop_unused(dev, mt);
293291
mt->frame++;
294-
295-
spin_unlock_irqrestore(&dev->event_lock, flags);
296292
}
297293
}
298294
EXPORT_SYMBOL(input_mt_drop_unused);
@@ -339,11 +335,8 @@ void input_mt_sync_frame(struct input_dev *dev)
339335
return;
340336

341337
if (mt->flags & INPUT_MT_DROP_UNUSED) {
342-
unsigned long flags;
343-
344-
spin_lock_irqsave(&dev->event_lock, flags);
338+
guard(spinlock_irqsave)(&dev->event_lock);
345339
__input_mt_drop_unused(dev, mt);
346-
spin_unlock_irqrestore(&dev->event_lock, flags);
347340
}
348341

349342
if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT))

0 commit comments

Comments
 (0)