11 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
14 #include <linux/slab.h>
17 #include <linux/module.h>
25 static void input_polldev_queue_work(
struct input_polled_dev *
dev)
38 struct input_polled_dev *dev =
42 input_polldev_queue_work(dev);
45 static int input_open_polled_device(
struct input_dev *
input)
47 struct input_polled_dev *dev = input_get_drvdata(input);
53 if (dev->poll_interval > 0) {
55 input_polldev_queue_work(dev);
61 static void input_close_polled_device(
struct input_dev *input)
63 struct input_polled_dev *dev = input_get_drvdata(input);
78 return sprintf(buf,
"%d\n", polldev->poll_interval);
86 struct input_dev *input = polldev->input;
97 if (interval > polldev->poll_interval_max)
106 if (polldev->poll_interval > 0)
107 input_polldev_queue_work(polldev);
116 input_polldev_set_poll);
124 return sprintf(buf,
"%d\n", polldev->poll_interval_max);
134 return sprintf(buf,
"%d\n", polldev->poll_interval_min);
139 static struct attribute *sysfs_attrs[] = {
158 struct input_polled_dev *
dev;
160 dev = kzalloc(
sizeof(
struct input_polled_dev),
GFP_KERNEL);
164 dev->input = input_allocate_device();
184 input_free_device(dev->input);
202 struct input_dev *input = dev->input;
205 input_set_drvdata(input, dev);
207 if (!dev->poll_interval)
208 dev->poll_interval = 500;
209 if (!dev->poll_interval_max)
210 dev->poll_interval_max = dev->poll_interval;
211 input->open = input_open_polled_device;
212 input->close = input_close_polled_device;
214 error = input_register_device(input);
219 &input_polldev_attribute_group);
221 input_unregister_device(input);
232 input_get_device(input);
249 &input_polldev_attribute_group);
251 input_unregister_device(dev->input);