Input: evdev - try to wake up readers only if we have full packet
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 18 Jun 2011 09:50:11 +0000 (02:50 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 18 Jun 2011 09:54:02 +0000 (02:54 -0700)
We should only wake waiters on the event device when we actually post
an EV_SYN/SYN_REPORT to the queue. Otherwise we end up making waiting
threads runnable only to go right back to sleep because the device
still isn't readable.

Reported-by: Jeffrey Brown <jeffbrown@android.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/evdev.c

index be0921ef6b52ace2a2e15a5d1437c6134799dbf0..4cf25347b01546b1578e0b9987d6717c38db0366 100644 (file)
@@ -111,7 +111,8 @@ static void evdev_event(struct input_handle *handle,
 
        rcu_read_unlock();
 
-       wake_up_interruptible(&evdev->wait);
+       if (type == EV_SYN && code == SYN_REPORT)
+               wake_up_interruptible(&evdev->wait);
 }
 
 static int evdev_fasync(int fd, struct file *file, int on)