X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=drivers%2Finput%2Finput-polldev.c;h=0d3ce7a50fb1a345ab10a8ff1926dc4635475a90;hb=837b41b5de356aa67abb2cadb5eef3efc7776f91;hp=b773d4c756a61333d1e5d65ae5cc282cbe01815b;hpb=6a91d25c0243bf20356e51cc5dbb821cc8cc129b;p=linux-2.6-omap-h63xx.git diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c index b773d4c756a..0d3ce7a50fb 100644 --- a/drivers/input/input-polldev.c +++ b/drivers/input/input-polldev.c @@ -60,15 +60,20 @@ static void input_polled_device_work(struct work_struct *work) { struct input_polled_dev *dev = container_of(work, struct input_polled_dev, work.work); + unsigned long delay; dev->poll(dev); - queue_delayed_work(polldev_wq, &dev->work, - msecs_to_jiffies(dev->poll_interval)); + + delay = msecs_to_jiffies(dev->poll_interval); + if (delay >= HZ) + delay = round_jiffies_relative(delay); + + queue_delayed_work(polldev_wq, &dev->work, delay); } static int input_open_polled_device(struct input_dev *input) { - struct input_polled_dev *dev = input->private; + struct input_polled_dev *dev = input_get_drvdata(input); int error; error = input_polldev_start_workqueue(); @@ -86,9 +91,9 @@ static int input_open_polled_device(struct input_dev *input) static void input_close_polled_device(struct input_dev *input) { - struct input_polled_dev *dev = input->private; + struct input_polled_dev *dev = input_get_drvdata(input); - cancel_rearming_delayed_workqueue(polldev_wq, &dev->work); + cancel_delayed_work_sync(&dev->work); input_polldev_stop_workqueue(); } @@ -146,10 +151,10 @@ int input_register_polled_device(struct input_polled_dev *dev) { struct input_dev *input = dev->input; + input_set_drvdata(input, dev); INIT_DELAYED_WORK(&dev->work, input_polled_device_work); if (!dev->poll_interval) dev->poll_interval = 500; - input->private = dev; input->open = input_open_polled_device; input->close = input_close_polled_device;