include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / input / input-polldev.c
index aa6713b..10c9b0a 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/jiffies.h>
+#include <linux/slab.h>
 #include <linux/mutex.h>
 #include <linux/input-polldev.h>
 
@@ -100,6 +101,12 @@ static void input_close_polled_device(struct input_dev *input)
        struct input_polled_dev *dev = input_get_drvdata(input);
 
        cancel_delayed_work_sync(&dev->work);
+       /*
+        * Clean up work struct to remove references to the workqueue.
+        * It may be destroyed by the next call. This causes problems
+        * at next device open-close in case of poll_interval == 0.
+        */
+       INIT_DELAYED_WORK(&dev->work, dev->work.work.func);
        input_polldev_stop_workqueue();
 
        if (dev->close)