summaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2008-06-02 00:41:57 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-06-02 00:41:57 -0400
commite8ef4347099584b49ecf74144ad2089b724292cf (patch)
tree2dd76225570d3f6d64785e588cf8f64454e59739 /drivers/input
parentf6d65610df3bd4e7138da03aec391224219df135 (diff)
downloadblackbird-op-linux-e8ef4347099584b49ecf74144ad2089b724292cf.tar.gz
blackbird-op-linux-e8ef4347099584b49ecf74144ad2089b724292cf.zip
Input: serio - remove pending events when unregistering driver
That fixes an opps when driver is repeatedly loaded and unloaded in a tight loop. Tested-by: Roland Kletzing <devzero@web.de> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/serio/serio.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 7f5293828fbf..78f2abb5c11b 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -331,9 +331,10 @@ static void serio_handle_event(void)
}
/*
- * Remove all events that have been submitted for a given serio port.
+ * Remove all events that have been submitted for a given
+ * object, be it serio port or driver.
*/
-static void serio_remove_pending_events(struct serio *serio)
+static void serio_remove_pending_events(void *object)
{
struct list_head *node, *next;
struct serio_event *event;
@@ -343,7 +344,7 @@ static void serio_remove_pending_events(struct serio *serio)
list_for_each_safe(node, next, &serio_event_list) {
event = list_entry(node, struct serio_event, node);
- if (event->object == serio) {
+ if (event->object == object) {
list_del_init(node);
serio_free_event(event);
}
@@ -837,7 +838,9 @@ void serio_unregister_driver(struct serio_driver *drv)
struct serio *serio;
mutex_lock(&serio_mutex);
+
drv->manual_bind = 1; /* so serio_find_driver ignores it */
+ serio_remove_pending_events(drv);
start_over:
list_for_each_entry(serio, &serio_list, node) {
OpenPOWER on IntegriCloud