diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-13 17:09:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-13 17:09:39 -0400 |
commit | eedab661a51966c454e38c17266a531aa58b4a98 (patch) | |
tree | 1f185821f45cccb2ecc91ae0303eda201eb83212 /drivers/input/misc | |
parent | c3bff2ec10b8bf2f53c954e370f9bdae93064472 (diff) | |
parent | 893e7c2db05f14032f2390ef7c59a499fc25ccae (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: move input-polldev to drivers/input
Input: i8042 - add ULI EV4873 to noloop list
Input: i8042 - add ASUS P65UP5 to the noloop list
Input: usbtouchscreen - fix fallout caused by move from drivers/usb
Diffstat (limited to 'drivers/input/misc')
-rw-r--r-- | drivers/input/misc/Kconfig | 11 | ||||
-rw-r--r-- | drivers/input/misc/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/misc/input-polldev.c | 176 |
3 files changed, 0 insertions, 188 deletions
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 842a7b4d16f8..88e29074ac90 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
@@ -170,17 +170,6 @@ config INPUT_UINPUT | |||
170 | To compile this driver as a module, choose M here: the | 170 | To compile this driver as a module, choose M here: the |
171 | module will be called uinput. | 171 | module will be called uinput. |
172 | 172 | ||
173 | config INPUT_POLLDEV | ||
174 | tristate "Polled input device skeleton" | ||
175 | help | ||
176 | Say Y here if you are using a driver for an input | ||
177 | device that periodically polls hardware state. This | ||
178 | option is only useful for out-of-tree drivers since | ||
179 | in-tree drivers select it automatically. | ||
180 | |||
181 | To compile this driver as a module, choose M here: the | ||
182 | module will be called input-polldev. | ||
183 | |||
184 | config HP_SDC_RTC | 173 | config HP_SDC_RTC |
185 | tristate "HP SDC Real Time Clock" | 174 | tristate "HP SDC Real Time Clock" |
186 | depends on GSC || HP300 | 175 | depends on GSC || HP300 |
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index 8b2f7799e25c..3585b5038418 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | # Each configuration option enables a list of files. | 5 | # Each configuration option enables a list of files. |
6 | 6 | ||
7 | obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o | ||
8 | obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o | 7 | obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o |
9 | obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o | 8 | obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o |
10 | obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o | 9 | obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o |
diff --git a/drivers/input/misc/input-polldev.c b/drivers/input/misc/input-polldev.c deleted file mode 100644 index b773d4c756a6..000000000000 --- a/drivers/input/misc/input-polldev.c +++ /dev/null | |||
@@ -1,176 +0,0 @@ | |||
1 | /* | ||
2 | * Generic implementation of a polled input device | ||
3 | |||
4 | * Copyright (c) 2007 Dmitry Torokhov | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License version 2 as published by | ||
8 | * the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/jiffies.h> | ||
12 | #include <linux/mutex.h> | ||
13 | #include <linux/input-polldev.h> | ||
14 | |||
15 | MODULE_AUTHOR("Dmitry Torokhov <dtor@mail.ru>"); | ||
16 | MODULE_DESCRIPTION("Generic implementation of a polled input device"); | ||
17 | MODULE_LICENSE("GPL v2"); | ||
18 | MODULE_VERSION("0.1"); | ||
19 | |||
20 | static DEFINE_MUTEX(polldev_mutex); | ||
21 | static int polldev_users; | ||
22 | static struct workqueue_struct *polldev_wq; | ||
23 | |||
24 | static int input_polldev_start_workqueue(void) | ||
25 | { | ||
26 | int retval; | ||
27 | |||
28 | retval = mutex_lock_interruptible(&polldev_mutex); | ||
29 | if (retval) | ||
30 | return retval; | ||
31 | |||
32 | if (!polldev_users) { | ||
33 | polldev_wq = create_singlethread_workqueue("ipolldevd"); | ||
34 | if (!polldev_wq) { | ||
35 | printk(KERN_ERR "input-polldev: failed to create " | ||
36 | "ipolldevd workqueue\n"); | ||
37 | retval = -ENOMEM; | ||
38 | goto out; | ||
39 | } | ||
40 | } | ||
41 | |||
42 | polldev_users++; | ||
43 | |||
44 | out: | ||
45 | mutex_unlock(&polldev_mutex); | ||
46 | return retval; | ||
47 | } | ||
48 | |||
49 | static void input_polldev_stop_workqueue(void) | ||
50 | { | ||
51 | mutex_lock(&polldev_mutex); | ||
52 | |||
53 | if (!--polldev_users) | ||
54 | destroy_workqueue(polldev_wq); | ||
55 | |||
56 | mutex_unlock(&polldev_mutex); | ||
57 | } | ||
58 | |||
59 | static void input_polled_device_work(struct work_struct *work) | ||
60 | { | ||
61 | struct input_polled_dev *dev = | ||
62 | container_of(work, struct input_polled_dev, work.work); | ||
63 | |||
64 | dev->poll(dev); | ||
65 | queue_delayed_work(polldev_wq, &dev->work, | ||
66 | msecs_to_jiffies(dev->poll_interval)); | ||
67 | } | ||
68 | |||
69 | static int input_open_polled_device(struct input_dev *input) | ||
70 | { | ||
71 | struct input_polled_dev *dev = input->private; | ||
72 | int error; | ||
73 | |||
74 | error = input_polldev_start_workqueue(); | ||
75 | if (error) | ||
76 | return error; | ||
77 | |||
78 | if (dev->flush) | ||
79 | dev->flush(dev); | ||
80 | |||
81 | queue_delayed_work(polldev_wq, &dev->work, | ||
82 | msecs_to_jiffies(dev->poll_interval)); | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | static void input_close_polled_device(struct input_dev *input) | ||
88 | { | ||
89 | struct input_polled_dev *dev = input->private; | ||
90 | |||
91 | cancel_rearming_delayed_workqueue(polldev_wq, &dev->work); | ||
92 | input_polldev_stop_workqueue(); | ||
93 | } | ||
94 | |||
95 | /** | ||
96 | * input_allocate_polled_device - allocated memory polled device | ||
97 | * | ||
98 | * The function allocates memory for a polled device and also | ||
99 | * for an input device associated with this polled device. | ||
100 | */ | ||
101 | struct input_polled_dev *input_allocate_polled_device(void) | ||
102 | { | ||
103 | struct input_polled_dev *dev; | ||
104 | |||
105 | dev = kzalloc(sizeof(struct input_polled_dev), GFP_KERNEL); | ||
106 | if (!dev) | ||
107 | return NULL; | ||
108 | |||
109 | dev->input = input_allocate_device(); | ||
110 | if (!dev->input) { | ||
111 | kfree(dev); | ||
112 | return NULL; | ||
113 | } | ||
114 | |||
115 | return dev; | ||
116 | } | ||
117 | EXPORT_SYMBOL(input_allocate_polled_device); | ||
118 | |||
119 | /** | ||
120 | * input_free_polled_device - free memory allocated for polled device | ||
121 | * @dev: device to free | ||
122 | * | ||
123 | * The function frees memory allocated for polling device and drops | ||
124 | * reference to the associated input device (if present). | ||
125 | */ | ||
126 | void input_free_polled_device(struct input_polled_dev *dev) | ||
127 | { | ||
128 | if (dev) { | ||
129 | input_free_device(dev->input); | ||
130 | kfree(dev); | ||
131 | } | ||
132 | } | ||
133 | EXPORT_SYMBOL(input_free_polled_device); | ||
134 | |||
135 | /** | ||
136 | * input_register_polled_device - register polled device | ||
137 | * @dev: device to register | ||
138 | * | ||
139 | * The function registers previously initialized polled input device | ||
140 | * with input layer. The device should be allocated with call to | ||
141 | * input_allocate_polled_device(). Callers should also set up poll() | ||
142 | * method and set up capabilities (id, name, phys, bits) of the | ||
143 | * corresponing input_dev structure. | ||
144 | */ | ||
145 | int input_register_polled_device(struct input_polled_dev *dev) | ||
146 | { | ||
147 | struct input_dev *input = dev->input; | ||
148 | |||
149 | INIT_DELAYED_WORK(&dev->work, input_polled_device_work); | ||
150 | if (!dev->poll_interval) | ||
151 | dev->poll_interval = 500; | ||
152 | input->private = dev; | ||
153 | input->open = input_open_polled_device; | ||
154 | input->close = input_close_polled_device; | ||
155 | |||
156 | return input_register_device(input); | ||
157 | } | ||
158 | EXPORT_SYMBOL(input_register_polled_device); | ||
159 | |||
160 | /** | ||
161 | * input_unregister_polled_device - unregister polled device | ||
162 | * @dev: device to unregister | ||
163 | * | ||
164 | * The function unregisters previously registered polled input | ||
165 | * device from input layer. Polling is stopped and device is | ||
166 | * ready to be freed with call to input_free_polled_device(). | ||
167 | * Callers should not attempt to access dev->input pointer | ||
168 | * after calling this function. | ||
169 | */ | ||
170 | void input_unregister_polled_device(struct input_polled_dev *dev) | ||
171 | { | ||
172 | input_unregister_device(dev->input); | ||
173 | dev->input = NULL; | ||
174 | } | ||
175 | EXPORT_SYMBOL(input_unregister_polled_device); | ||
176 | |||