diff options
author | Arve Hjønnevåg <arve@android.com> | 2012-01-23 17:15:45 -0800 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-02-03 05:55:18 -0800 |
commit | 41b21130fd7c9ad2b241b3e6174f0c8e4ea111b7 (patch) | |
tree | 5252443c7f36fd4333210b77bf0e122b1a135f0f /drivers/input | |
parent | 6139e2371765737ca134fa34bb381fad0de87f58 (diff) |
Input: evdev - Don't hold wakelock when no data is available to user-space
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 <arve@android.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Change-Id: I7555b190ff8e4e526291dd353c3c0291b05dfff2
Reviewed-on: http://git-master/r/78894
Reviewed-by: Automatic_Commit_Validation_User
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/evdev.c | 5 |
1 files changed, 3 insertions, 2 deletions
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); } |