upgrade iop32x to 2.6.30
[openwrt.git] / target / linux / goldfish / patches-2.6.30 / 0087-Input-Hold-wake-lock-while-event-queue-is-not-empty.patch
1 From 0d1077627288e51b5604f270eae6cf9f5ccd3871 Mon Sep 17 00:00:00 2001
2 From: =?utf-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com>
3 Date: Fri, 17 Oct 2008 15:20:55 -0700
4 Subject: [PATCH 087/134] Input: Hold wake lock while event queue is not empty.
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=utf-8
7 Content-Transfer-Encoding: 8bit
8
9 Allows userspace code to process input events while
10 the device appears to be asleep.
11
12 Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 ---
14 drivers/input/evdev.c | 7 +++++++
15 1 files changed, 7 insertions(+), 0 deletions(-)
16
17 --- a/drivers/input/evdev.c
18 +++ b/drivers/input/evdev.c
19 @@ -19,6 +19,7 @@
20 #include <linux/input.h>
21 #include <linux/major.h>
22 #include <linux/device.h>
23 +#include <linux/wakelock.h>
24 #include "input-compat.h"
25
26 struct evdev {
27 @@ -43,6 +44,7 @@ struct evdev_client {
28 struct fasync_struct *fasync;
29 struct evdev *evdev;
30 struct list_head node;
31 + struct wake_lock wake_lock;
32 };
33
34 static struct evdev *evdev_table[EVDEV_MINORS];
35 @@ -55,6 +57,7 @@ static void evdev_pass_event(struct evde
36 * Interrupts are disabled, just acquire the lock
37 */
38 spin_lock(&client->buffer_lock);
39 + wake_lock_timeout(&client->wake_lock, 5 * HZ);
40 client->buffer[client->head++] = *event;
41 client->head &= EVDEV_BUFFER_SIZE - 1;
42 spin_unlock(&client->buffer_lock);
43 @@ -233,6 +236,7 @@ static int evdev_release(struct inode *i
44 mutex_unlock(&evdev->mutex);
45
46 evdev_detach_client(evdev, client);
47 + wake_lock_destroy(&client->wake_lock);
48 kfree(client);
49
50 evdev_close_device(evdev);
51 @@ -269,6 +273,7 @@ static int evdev_open(struct inode *inod
52 }
53
54 spin_lock_init(&client->buffer_lock);
55 + wake_lock_init(&client->wake_lock, WAKE_LOCK_SUSPEND, "evdev");
56 client->evdev = evdev;
57 evdev_attach_client(evdev, client);
58
59 @@ -332,6 +337,8 @@ static int evdev_fetch_next_event(struct
60 if (have_event) {
61 *event = client->buffer[client->tail++];
62 client->tail &= EVDEV_BUFFER_SIZE - 1;
63 + if (client->head == client->tail)
64 + wake_unlock(&client->wake_lock);
65 }
66
67 spin_unlock_irq(&client->buffer_lock);
This page took 0.05839 seconds and 5 git commands to generate.