From 11bb4cc7c772963952304398f999fc195b0da285 Mon Sep 17 00:00:00 2001 From: Samu Onkalo Date: Mon, 23 Nov 2009 10:01:33 -0800 Subject: Input: polled device - do not start polling if interval is zero 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 Signed-off-by: Dmitry Torokhov --- drivers/input/input-polldev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/input/input-polldev.c') diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c index 40cf0b05892..6a2eb399b98 100644 --- a/drivers/input/input-polldev.c +++ b/drivers/input/input-polldev.c @@ -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; } -- cgit v1.2.3