summaryrefslogtreecommitdiff
path: root/drivers/input/input.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2012-08-10 23:36:15 +0400
committerHenrik Rydberg <rydberg@euromail.se>2012-09-19 21:50:17 +0400
commit352ac4bd018005cfa6f844433a98aa0b724fa8db (patch)
tree70c6425b9b1f2d029b7d9a16659c7d709aa35ccb /drivers/input/input.c
parent0672120a2ee7c533dfec6db7c3e43450f439e5ff (diff)
downloadlinux-352ac4bd018005cfa6f844433a98aa0b724fa8db.tar.xz
Input: Move autorepeat to the event-passing phase
Preparing to split event filtering and event passing, move the autorepeat function to the point where the event is actually passed. Tested-by: Benjamin Tissoires <benjamin.tissoires@enac.fr> Tested-by: Ping Cheng <pingc@wacom.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r--drivers/input/input.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index f075fbbfb1e7..fbe522d0ead7 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -69,6 +69,22 @@ static int input_defuzz_abs_event(int value, int old_val, int fuzz)
return value;
}
+static void input_start_autorepeat(struct input_dev *dev, int code)
+{
+ if (test_bit(EV_REP, dev->evbit) &&
+ dev->rep[REP_PERIOD] && dev->rep[REP_DELAY] &&
+ dev->timer.data) {
+ dev->repeat_key = code;
+ mod_timer(&dev->timer,
+ jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]));
+ }
+}
+
+static void input_stop_autorepeat(struct input_dev *dev)
+{
+ del_timer(&dev->timer);
+}
+
/*
* Pass event first through all filters and then, if event has not been
* filtered out, through all open handles. This function is called with
@@ -105,6 +121,15 @@ static void input_pass_event(struct input_dev *dev,
}
rcu_read_unlock();
+
+ /* trigger auto repeat for key events */
+ if (type == EV_KEY && value != 2) {
+ if (value)
+ input_start_autorepeat(dev, code);
+ else
+ input_stop_autorepeat(dev);
+ }
+
}
/*
@@ -142,22 +167,6 @@ static void input_repeat_key(unsigned long data)
spin_unlock_irqrestore(&dev->event_lock, flags);
}
-static void input_start_autorepeat(struct input_dev *dev, int code)
-{
- if (test_bit(EV_REP, dev->evbit) &&
- dev->rep[REP_PERIOD] && dev->rep[REP_DELAY] &&
- dev->timer.data) {
- dev->repeat_key = code;
- mod_timer(&dev->timer,
- jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]));
- }
-}
-
-static void input_stop_autorepeat(struct input_dev *dev)
-{
- del_timer(&dev->timer);
-}
-
#define INPUT_IGNORE_EVENT 0
#define INPUT_PASS_TO_HANDLERS 1
#define INPUT_PASS_TO_DEVICE 2
@@ -252,11 +261,6 @@ static void input_handle_event(struct input_dev *dev,
__change_bit(code, dev->key);
disposition = INPUT_PASS_TO_HANDLERS;
-
- if (value)
- input_start_autorepeat(dev, code);
- else
- input_stop_autorepeat(dev);
}
}
break;