aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamu Onkalo <samu.p.onkalo@nokia.com>2009-10-18 03:38:57 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-10-18 03:46:49 -0400
commitb0aba1e66c38d64be2c7dbf4b08c71857031ab67 (patch)
tree1691861b033ef42331b30711a466025719f357c8
parentbc09dcadc1a3da87d58aa70ebc8e9441205be75c (diff)
Input: add open and close methods for polled devices
Optional open and close methods for preparing and closing the device. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--drivers/input/input-polldev.c7
-rw-r--r--drivers/input/misc/wistron_btns.c2
-rw-r--r--include/linux/input-polldev.h11
3 files changed, 13 insertions, 7 deletions
diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c
index 0d3ce7a50fb1..910220c127cb 100644
--- a/drivers/input/input-polldev.c
+++ b/drivers/input/input-polldev.c
@@ -80,8 +80,8 @@ static int input_open_polled_device(struct input_dev *input)
80 if (error) 80 if (error)
81 return error; 81 return error;
82 82
83 if (dev->flush) 83 if (dev->open)
84 dev->flush(dev); 84 dev->open(dev);
85 85
86 queue_delayed_work(polldev_wq, &dev->work, 86 queue_delayed_work(polldev_wq, &dev->work,
87 msecs_to_jiffies(dev->poll_interval)); 87 msecs_to_jiffies(dev->poll_interval));
@@ -95,6 +95,9 @@ static void input_close_polled_device(struct input_dev *input)
95 95
96 cancel_delayed_work_sync(&dev->work); 96 cancel_delayed_work_sync(&dev->work);
97 input_polldev_stop_workqueue(); 97 input_polldev_stop_workqueue();
98
99 if (dev->close)
100 dev->close(dev);
98} 101}
99 102
100/** 103/**
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index a932179c4c9e..00eb9d651d97 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -1263,7 +1263,7 @@ static int __devinit setup_input_dev(void)
1263 if (!wistron_idev) 1263 if (!wistron_idev)
1264 return -ENOMEM; 1264 return -ENOMEM;
1265 1265
1266 wistron_idev->flush = wistron_flush; 1266 wistron_idev->open = wistron_flush;
1267 wistron_idev->poll = wistron_poll; 1267 wistron_idev->poll = wistron_poll;
1268 wistron_idev->poll_interval = POLL_INTERVAL_DEFAULT; 1268 wistron_idev->poll_interval = POLL_INTERVAL_DEFAULT;
1269 1269
diff --git a/include/linux/input-polldev.h b/include/linux/input-polldev.h
index 597a0077b3c5..5c0ec68a965e 100644
--- a/include/linux/input-polldev.h
+++ b/include/linux/input-polldev.h
@@ -14,9 +14,11 @@
14 14
15/** 15/**
16 * struct input_polled_dev - simple polled input device 16 * struct input_polled_dev - simple polled input device
17 * @private: private driver data 17 * @private: private driver data.
18 * @flush: driver-supplied method that flushes device's state upon 18 * @open: driver-supplied method that prepares device for polling
19 * opening (optional) 19 * (enabled the device and maybe flushes device state).
20 * @close: driver-supplied method that is called when device is no
21 * longer being polled. Used to put device into low power mode.
20 * @poll: driver-supplied method that polls the device and posts 22 * @poll: driver-supplied method that polls the device and posts
21 * input events (mandatory). 23 * input events (mandatory).
22 * @poll_interval: specifies how often the poll() method shoudl be called. 24 * @poll_interval: specifies how often the poll() method shoudl be called.
@@ -30,7 +32,8 @@
30struct input_polled_dev { 32struct input_polled_dev {
31 void *private; 33 void *private;
32 34
33 void (*flush)(struct input_polled_dev *dev); 35 void (*open)(struct input_polled_dev *dev);
36 void (*close)(struct input_polled_dev *dev);
34 void (*poll)(struct input_polled_dev *dev); 37 void (*poll)(struct input_polled_dev *dev);
35 unsigned int poll_interval; /* msec */ 38 unsigned int poll_interval; /* msec */
36 39