]> err.no Git - linux-2.6/commitdiff
Input: polled device power saving
authorStephen Hemminger <shemminger@linux-foundation.org>
Wed, 26 Sep 2007 04:01:25 +0000 (00:01 -0400)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 26 Sep 2007 04:01:25 +0000 (00:01 -0400)
For slow running polling, it saves power to align wakeups on tick boundary.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/input-polldev.c

index b773d4c756a61333d1e5d65ae5cc282cbe01815b..92b359894e81ed89d7608c90e4f52a2173daa8c3 100644 (file)
@@ -70,6 +70,7 @@ static int input_open_polled_device(struct input_dev *input)
 {
        struct input_polled_dev *dev = input->private;
        int error;
+       unsigned long ticks;
 
        error = input_polldev_start_workqueue();
        if (error)
@@ -78,8 +79,10 @@ static int input_open_polled_device(struct input_dev *input)
        if (dev->flush)
                dev->flush(dev);
 
-       queue_delayed_work(polldev_wq, &dev->work,
-                          msecs_to_jiffies(dev->poll_interval));
+       ticks = msecs_to_jiffies(dev->poll_interval);
+       if (ticks >= HZ)
+               ticks = round_jiffies(ticks);
+       queue_delayed_work(polldev_wq, &dev->work, ticks);
 
        return 0;
 }