@@ -59,12 +59,13 @@ static void input_polldev_stop_workqueue(void)
static void input_polldev_queue_work(struct input_polled_dev *dev)
{
unsigned long delay;
+ if (dev->poll_interval > 0) {
+ delay = msecs_to_jiffies(dev->poll_interval);
+ if (delay >= HZ)
+ delay = round_jiffies_relative(delay);
- delay = msecs_to_jiffies(dev->poll_interval);
- if (delay >= HZ)
- delay = round_jiffies_relative(delay);
-
- queue_delayed_work(polldev_wq, &dev->work, delay);
+ queue_delayed_work(polldev_wq, &dev->work, delay);
+ }
}
static void input_polled_device_work(struct work_struct *work)
@@ -88,8 +89,7 @@ static int input_open_polled_device(struct input_dev *input)
if (dev->open)
dev->open(dev);
- queue_delayed_work(polldev_wq, &dev->work,
- msecs_to_jiffies(dev->poll_interval));
+ input_polldev_queue_work(dev);
return 0;
}
@@ -138,8 +138,7 @@ static ssize_t input_polldev_set_poll(struct device *dev,
if (input->users) {
cancel_delayed_work_sync(&polldev->work);
- if (polldev->poll_interval > 0)
- input_polldev_queue_work(polldev);
+ input_polldev_queue_work(polldev);
}
mutex_unlock(&input->mutex);