diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2006-09-17 12:17:19 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2006-09-17 12:19:31 -0400 |
commit | 9b4f2e9576658c4e52d95dc8d309f51b2e2db096 (patch) | |
tree | 7b1902b0f931783fccc6fee45c6f9c16b4fde5ce /drivers/input/input.c | |
parent | 3c6c65f5ed5a6d307bd607aecd06d658c0934d88 (diff) | |
parent | 803db244b9f71102e366fd689000c1417b9a7508 (diff) |
ieee1394: merge from Linus
Conflicts: drivers/ieee1394/hosts.c
Patch "lockdep: annotate ieee1394 skb-queue-head locking" was meddling
with patch "ieee1394: fix kerneldoc of hpsb_alloc_host".
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r-- | drivers/input/input.c | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index a90486f5e491..9cb4b9a54f01 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -35,6 +35,16 @@ static LIST_HEAD(input_handler_list); | |||
35 | 35 | ||
36 | static struct input_handler *input_table[8]; | 36 | static struct input_handler *input_table[8]; |
37 | 37 | ||
38 | /** | ||
39 | * input_event() - report new input event | ||
40 | * @handle: device that generated the event | ||
41 | * @type: type of the event | ||
42 | * @code: event code | ||
43 | * @value: value of the event | ||
44 | * | ||
45 | * This function should be used by drivers implementing various input devices | ||
46 | * See also input_inject_event() | ||
47 | */ | ||
38 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 48 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
39 | { | 49 | { |
40 | struct input_handle *handle; | 50 | struct input_handle *handle; |
@@ -183,6 +193,23 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in | |||
183 | } | 193 | } |
184 | EXPORT_SYMBOL(input_event); | 194 | EXPORT_SYMBOL(input_event); |
185 | 195 | ||
196 | /** | ||
197 | * input_inject_event() - send input event from input handler | ||
198 | * @handle: input handle to send event through | ||
199 | * @type: type of the event | ||
200 | * @code: event code | ||
201 | * @value: value of the event | ||
202 | * | ||
203 | * Similar to input_event() but will ignore event if device is "grabbed" and handle | ||
204 | * injecting event is not the one that owns the device. | ||
205 | */ | ||
206 | void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) | ||
207 | { | ||
208 | if (!handle->dev->grab || handle->dev->grab == handle) | ||
209 | input_event(handle->dev, type, code, value); | ||
210 | } | ||
211 | EXPORT_SYMBOL(input_inject_event); | ||
212 | |||
186 | static void input_repeat_key(unsigned long data) | 213 | static void input_repeat_key(unsigned long data) |
187 | { | 214 | { |
188 | struct input_dev *dev = (void *) data; | 215 | struct input_dev *dev = (void *) data; |
@@ -197,15 +224,6 @@ static void input_repeat_key(unsigned long data) | |||
197 | mod_timer(&dev->timer, jiffies + msecs_to_jiffies(dev->rep[REP_PERIOD])); | 224 | mod_timer(&dev->timer, jiffies + msecs_to_jiffies(dev->rep[REP_PERIOD])); |
198 | } | 225 | } |
199 | 226 | ||
200 | int input_accept_process(struct input_handle *handle, struct file *file) | ||
201 | { | ||
202 | if (handle->dev->accept) | ||
203 | return handle->dev->accept(handle->dev, file); | ||
204 | |||
205 | return 0; | ||
206 | } | ||
207 | EXPORT_SYMBOL(input_accept_process); | ||
208 | |||
209 | int input_grab_device(struct input_handle *handle) | 227 | int input_grab_device(struct input_handle *handle) |
210 | { | 228 | { |
211 | if (handle->dev->grab) | 229 | if (handle->dev->grab) |
@@ -218,8 +236,15 @@ EXPORT_SYMBOL(input_grab_device); | |||
218 | 236 | ||
219 | void input_release_device(struct input_handle *handle) | 237 | void input_release_device(struct input_handle *handle) |
220 | { | 238 | { |
221 | if (handle->dev->grab == handle) | 239 | struct input_dev *dev = handle->dev; |
222 | handle->dev->grab = NULL; | 240 | |
241 | if (dev->grab == handle) { | ||
242 | dev->grab = NULL; | ||
243 | |||
244 | list_for_each_entry(handle, &dev->h_list, d_node) | ||
245 | if (handle->handler->start) | ||
246 | handle->handler->start(handle); | ||
247 | } | ||
223 | } | 248 | } |
224 | EXPORT_SYMBOL(input_release_device); | 249 | EXPORT_SYMBOL(input_release_device); |
225 | 250 | ||
@@ -963,8 +988,11 @@ int input_register_device(struct input_dev *dev) | |||
963 | list_for_each_entry(handler, &input_handler_list, node) | 988 | list_for_each_entry(handler, &input_handler_list, node) |
964 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) | 989 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) |
965 | if ((id = input_match_device(handler->id_table, dev))) | 990 | if ((id = input_match_device(handler->id_table, dev))) |
966 | if ((handle = handler->connect(handler, dev, id))) | 991 | if ((handle = handler->connect(handler, dev, id))) { |
967 | input_link_handle(handle); | 992 | input_link_handle(handle); |
993 | if (handler->start) | ||
994 | handler->start(handle); | ||
995 | } | ||
968 | 996 | ||
969 | input_wakeup_procfs_readers(); | 997 | input_wakeup_procfs_readers(); |
970 | 998 | ||
@@ -1028,8 +1056,11 @@ void input_register_handler(struct input_handler *handler) | |||
1028 | list_for_each_entry(dev, &input_dev_list, node) | 1056 | list_for_each_entry(dev, &input_dev_list, node) |
1029 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) | 1057 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) |
1030 | if ((id = input_match_device(handler->id_table, dev))) | 1058 | if ((id = input_match_device(handler->id_table, dev))) |
1031 | if ((handle = handler->connect(handler, dev, id))) | 1059 | if ((handle = handler->connect(handler, dev, id))) { |
1032 | input_link_handle(handle); | 1060 | input_link_handle(handle); |
1061 | if (handler->start) | ||
1062 | handler->start(handle); | ||
1063 | } | ||
1033 | 1064 | ||
1034 | input_wakeup_procfs_readers(); | 1065 | input_wakeup_procfs_readers(); |
1035 | } | 1066 | } |