aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r--drivers/input/input.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 213e3a1903ee..cc357f1516a7 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -100,23 +100,24 @@ static unsigned int input_to_handler(struct input_handle *handle,
100 struct input_value *end = vals; 100 struct input_value *end = vals;
101 struct input_value *v; 101 struct input_value *v;
102 102
103 for (v = vals; v != vals + count; v++) { 103 if (handler->filter) {
104 if (handler->filter && 104 for (v = vals; v != vals + count; v++) {
105 handler->filter(handle, v->type, v->code, v->value)) 105 if (handler->filter(handle, v->type, v->code, v->value))
106 continue; 106 continue;
107 if (end != v) 107 if (end != v)
108 *end = *v; 108 *end = *v;
109 end++; 109 end++;
110 }
111 count = end - vals;
110 } 112 }
111 113
112 count = end - vals;
113 if (!count) 114 if (!count)
114 return 0; 115 return 0;
115 116
116 if (handler->events) 117 if (handler->events)
117 handler->events(handle, vals, count); 118 handler->events(handle, vals, count);
118 else if (handler->event) 119 else if (handler->event)
119 for (v = vals; v != end; v++) 120 for (v = vals; v != vals + count; v++)
120 handler->event(handle, v->type, v->code, v->value); 121 handler->event(handle, v->type, v->code, v->value);
121 122
122 return count; 123 return count;
@@ -143,8 +144,11 @@ static void input_pass_values(struct input_dev *dev,
143 count = input_to_handler(handle, vals, count); 144 count = input_to_handler(handle, vals, count);
144 } else { 145 } else {
145 list_for_each_entry_rcu(handle, &dev->h_list, d_node) 146 list_for_each_entry_rcu(handle, &dev->h_list, d_node)
146 if (handle->open) 147 if (handle->open) {
147 count = input_to_handler(handle, vals, count); 148 count = input_to_handler(handle, vals, count);
149 if (!count)
150 break;
151 }
148 } 152 }
149 153
150 rcu_read_unlock(); 154 rcu_read_unlock();
@@ -152,12 +156,14 @@ static void input_pass_values(struct input_dev *dev,
152 add_input_randomness(vals->type, vals->code, vals->value); 156 add_input_randomness(vals->type, vals->code, vals->value);
153 157
154 /* trigger auto repeat for key events */ 158 /* trigger auto repeat for key events */
155 for (v = vals; v != vals + count; v++) { 159 if (test_bit(EV_REP, dev->evbit) && test_bit(EV_KEY, dev->evbit)) {
156 if (v->type == EV_KEY && v->value != 2) { 160 for (v = vals; v != vals + count; v++) {
157 if (v->value) 161 if (v->type == EV_KEY && v->value != 2) {
158 input_start_autorepeat(dev, v->code); 162 if (v->value)
159 else 163 input_start_autorepeat(dev, v->code);
160 input_stop_autorepeat(dev); 164 else
165 input_stop_autorepeat(dev);
166 }
161 } 167 }
162 } 168 }
163} 169}