aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/evdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/evdev.c')
-rw-r--r--drivers/input/evdev.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 30836c05edd7..cd323254ca6f 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -54,11 +54,15 @@ static void evdev_pass_event(struct evdev_client *client,
54 struct input_event *event) 54 struct input_event *event)
55{ 55{
56 /* 56 /*
57 * Interrupts are disabled, just acquire the lock 57 * Interrupts are disabled, just acquire the lock.
58 * Make sure we don't leave with the client buffer
59 * "empty" by having client->head == client->tail.
58 */ 60 */
59 spin_lock(&client->buffer_lock); 61 spin_lock(&client->buffer_lock);
60 client->buffer[client->head++] = *event; 62 do {
61 client->head &= client->bufsize - 1; 63 client->buffer[client->head++] = *event;
64 client->head &= client->bufsize - 1;
65 } while (client->head == client->tail);
62 spin_unlock(&client->buffer_lock); 66 spin_unlock(&client->buffer_lock);
63 67
64 if (event->type == EV_SYN) 68 if (event->type == EV_SYN)