Commit 4e3929ce authored by Dmitry Torokhov's avatar Dmitry Torokhov
Browse files

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: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 96173d61
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -285,14 +285,10 @@ void input_mt_drop_unused(struct input_dev *dev)
	struct input_mt *mt = dev->mt;

	if (mt) {
		unsigned long flags;

		spin_lock_irqsave(&dev->event_lock, flags);
		guard(spinlock_irqsave)(&dev->event_lock);

		__input_mt_drop_unused(dev, mt);
		mt->frame++;

		spin_unlock_irqrestore(&dev->event_lock, flags);
	}
}
EXPORT_SYMBOL(input_mt_drop_unused);
@@ -339,11 +335,8 @@ void input_mt_sync_frame(struct input_dev *dev)
		return;

	if (mt->flags & INPUT_MT_DROP_UNUSED) {
		unsigned long flags;

		spin_lock_irqsave(&dev->event_lock, flags);
		guard(spinlock_irqsave)(&dev->event_lock);
		__input_mt_drop_unused(dev, mt);
		spin_unlock_irqrestore(&dev->event_lock, flags);
	}

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