@@ -88,9 +88,17 @@ static int input_open_polled_device(struct input_dev *input)
if (dev->open)
dev->open(dev);
- /* Only start polling if polling is enabled */
+ /*
+ * Only start polling if polling is enabled.
+ * If polling is not running, clean up work struct since
+ * pointer to just allocated WQ may have been changed since
+ * previous use. If polling is not used, canceling of the
+ * work goes crazy.
+ */
if (dev->poll_interval > 0)
queue_delayed_work(polldev_wq, &dev->work, 0);
+ else
+ INIT_DELAYED_WORK(&dev->work, input_polled_device_work);
return 0;
}