diff mbox

input-polldev: Poll interval setting can cause polling with zero interval

Message ID 1258975304-4751-1-git-send-email-samu.p.onkalo@nokia.com (mailing list archive)
State New, archived
Headers show

Commit Message

samu.p.onkalo@nokia.com Nov. 23, 2009, 11:21 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c
index 3187427..2d2c626 100644
--- a/drivers/input/input-polldev.c
+++ b/drivers/input/input-polldev.c
@@ -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);