]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
Input: polled device - do not start polling if interval is zero
authorSamu Onkalo <samu.p.onkalo@nokia.com>
Mon, 23 Nov 2009 18:01:33 +0000 (10:01 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 23 Nov 2009 18:16:09 +0000 (10:16 -0800)
If the poll interval is set to 0 via new sysfs entry and device is
opened after that, polling is started with interval 0. This causes
huge CPU load. Same happens if the rate was 0 when the device was
closed and then reopened.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/input-polldev.c

index 40cf0b058927324cf2860dfb6842dcd7e9ff1819..6a2eb399b98820fc9d88c8547d1191d0386284ba 100644 (file)
@@ -88,7 +88,9 @@ static int input_open_polled_device(struct input_dev *input)
        if (dev->open)
                dev->open(dev);
 
-       queue_delayed_work(polldev_wq, &dev->work, 0);
+       /* Only start polling if polling is enabled */
+       if (dev->poll_interval > 0)
+               queue_delayed_work(polldev_wq, &dev->work, 0);
 
        return 0;
 }