aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/serio/serio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/serio/serio.c')
-rw-r--r--drivers/input/serio/serio.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index db5b0bca1a1a..7c38d1fbabf2 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -188,7 +188,8 @@ static void serio_free_event(struct serio_event *event)
188 kfree(event); 188 kfree(event);
189} 189}
190 190
191static void serio_remove_duplicate_events(struct serio_event *event) 191static void serio_remove_duplicate_events(void *object,
192 enum serio_event_type type)
192{ 193{
193 struct serio_event *e, *next; 194 struct serio_event *e, *next;
194 unsigned long flags; 195 unsigned long flags;
@@ -196,13 +197,13 @@ static void serio_remove_duplicate_events(struct serio_event *event)
196 spin_lock_irqsave(&serio_event_lock, flags); 197 spin_lock_irqsave(&serio_event_lock, flags);
197 198
198 list_for_each_entry_safe(e, next, &serio_event_list, node) { 199 list_for_each_entry_safe(e, next, &serio_event_list, node) {
199 if (event->object == e->object) { 200 if (object == e->object) {
200 /* 201 /*
201 * If this event is of different type we should not 202 * If this event is of different type we should not
202 * look further - we only suppress duplicate events 203 * look further - we only suppress duplicate events
203 * that were sent back-to-back. 204 * that were sent back-to-back.
204 */ 205 */
205 if (event->type != e->type) 206 if (type != e->type)
206 break; 207 break;
207 208
208 list_del_init(&e->node); 209 list_del_init(&e->node);
@@ -245,7 +246,7 @@ static void serio_handle_event(struct work_struct *work)
245 break; 246 break;
246 } 247 }
247 248
248 serio_remove_duplicate_events(event); 249 serio_remove_duplicate_events(event->object, event->type);
249 serio_free_event(event); 250 serio_free_event(event);
250 } 251 }
251 252
@@ -436,10 +437,12 @@ static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *
436 } else if (!strncmp(buf, "rescan", count)) { 437 } else if (!strncmp(buf, "rescan", count)) {
437 serio_disconnect_port(serio); 438 serio_disconnect_port(serio);
438 serio_find_driver(serio); 439 serio_find_driver(serio);
440 serio_remove_duplicate_events(serio, SERIO_RESCAN_PORT);
439 } else if ((drv = driver_find(buf, &serio_bus)) != NULL) { 441 } else if ((drv = driver_find(buf, &serio_bus)) != NULL) {
440 serio_disconnect_port(serio); 442 serio_disconnect_port(serio);
441 error = serio_bind_driver(serio, to_serio_driver(drv)); 443 error = serio_bind_driver(serio, to_serio_driver(drv));
442 put_driver(drv); 444 put_driver(drv);
445 serio_remove_duplicate_events(serio, SERIO_RESCAN_PORT);
443 } else { 446 } else {
444 error = -EINVAL; 447 error = -EINVAL;
445 } 448 }