aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/input.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-01-30 02:17:52 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-01-30 02:43:21 -0500
commite7b5c1ef4d87426da0b689a0a4fa67edda02ea5c (patch)
tree937c51ff46caa827092da1389e344fbfaeb90481 /drivers/input/input.c
parentb0ee0d3eb31a163c958f2960906c44bcdfdc607b (diff)
Input: stop autorepeat timer on key release
Whenever you press and then release a key, the CPU wakes up three times: * press * release * autorepeat timer exactly 250ms after press The autorepeat timer has nothing to do, obviously, since you already have released the key, so stop it on key release. [dtor@mail.ru: This changes autorepeat behavior a bit since we now stop autorepeat even if key that is being released is not the one that is being auto-repeated, but I believe the new behavior is better.] Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r--drivers/input/input.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 1730d7331a5d..46e9ce195064 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -132,6 +132,11 @@ static void input_start_autorepeat(struct input_dev *dev, int code)
132 } 132 }
133} 133}
134 134
135static void input_stop_autorepeat(struct input_dev *dev)
136{
137 del_timer(&dev->timer);
138}
139
135#define INPUT_IGNORE_EVENT 0 140#define INPUT_IGNORE_EVENT 0
136#define INPUT_PASS_TO_HANDLERS 1 141#define INPUT_PASS_TO_HANDLERS 1
137#define INPUT_PASS_TO_DEVICE 2 142#define INPUT_PASS_TO_DEVICE 2
@@ -167,6 +172,8 @@ static void input_handle_event(struct input_dev *dev,
167 __change_bit(code, dev->key); 172 __change_bit(code, dev->key);
168 if (value) 173 if (value)
169 input_start_autorepeat(dev, code); 174 input_start_autorepeat(dev, code);
175 else
176 input_stop_autorepeat(dev);
170 } 177 }
171 178
172 disposition = INPUT_PASS_TO_HANDLERS; 179 disposition = INPUT_PASS_TO_HANDLERS;