summaryrefslogtreecommitdiffstats
path: root/drivers/input/input-polldev.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-09-26 06:01:25 +0200
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2007-09-26 06:01:25 +0200
commit14134b31ae646220a5a451e38aae1dd023d457cb (patch)
tree44bf08a1793b372bf27091098167ea0f53c43b43 /drivers/input/input-polldev.c
parentInput: gpio-keys - add suspend/resume support (diff)
downloadlinux-14134b31ae646220a5a451e38aae1dd023d457cb.tar.xz
linux-14134b31ae646220a5a451e38aae1dd023d457cb.zip
Input: polled device power saving
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>
Diffstat (limited to 'drivers/input/input-polldev.c')
-rw-r--r--drivers/input/input-polldev.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c
index b773d4c756a6..92b359894e81 100644
--- a/drivers/input/input-polldev.c
+++ b/drivers/input/input-polldev.c
@@ -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;
}