From 41b21130fd7c9ad2b241b3e6174f0c8e4ea111b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= Date: Mon, 23 Jan 2012 17:15:45 -0800 Subject: Input: evdev - Don't hold wakelock when no data is available to user-space MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If there is no SYN_REPORT event in the buffer the buffer data is invisible to user-space. The wakelock should not be held in this case. (cherry picked from commit 7cc846069a8a9116d8c81526c459070eed0e3477 from android.googlesource.com/common.git) Signed-off-by: Arve Hjønnevåg Signed-off-by: Varun Wadekar Change-Id: I7555b190ff8e4e526291dd353c3c0291b05dfff2 Reviewed-on: http://git-master/r/78894 Reviewed-by: Automatic_Commit_Validation_User --- drivers/input/evdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/input/evdev.c') diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 6e7dd687d5c9..031195fa9297 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -62,7 +62,6 @@ static void evdev_pass_event(struct evdev_client *client, /* Interrupts are disabled, just acquire the lock. */ spin_lock(&client->buffer_lock); - wake_lock_timeout(&client->wake_lock, 5 * HZ); client->buffer[client->head++] = *event; client->head &= client->bufsize - 1; @@ -79,10 +78,12 @@ static void evdev_pass_event(struct evdev_client *client, client->buffer[client->tail].value = 0; client->packet_head = client->tail; + wake_unlock(&client->wake_lock); } if (event->type == EV_SYN && event->code == SYN_REPORT) { client->packet_head = client->head; + wake_lock_timeout(&client->wake_lock, 5 * HZ); kill_fasync(&client->fasync, SIGIO, POLL_IN); } @@ -385,7 +386,7 @@ static int evdev_fetch_next_event(struct evdev_client *client, if (have_event) { *event = client->buffer[client->tail++]; client->tail &= client->bufsize - 1; - if (client->head == client->tail) + if (client->packet_head == client->tail) wake_unlock(&client->wake_lock); } -- cgit v1.2.3