aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/input-polldev.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2009-12-04 13:22:23 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-12-07 12:26:35 -0500
commit36203c4f3d091b5f6c082663bd1f74273798043a (patch)
treebf5b6efee8f15aae253155263038ac538f7482e9 /drivers/input/input-polldev.c
parent6a47081c37b7dd7810ce19e156c1a3bf11987e9a (diff)
Input: add generic support for sparse keymaps
More and more devices choose to reimplement support for sparse keymaps first introduced by wistron driver. Move it into a library module so it can be easily used by interested parties. Reviewed-by: Anisse Astier <anisse@astier.eu> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/input-polldev.c')
-rw-r--r--drivers/input/input-polldev.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c
index 6a2eb399b988..aa6713b4a988 100644
--- a/drivers/input/input-polldev.c
+++ b/drivers/input/input-polldev.c
@@ -212,7 +212,7 @@ EXPORT_SYMBOL(input_allocate_polled_device);
212 * @dev: device to free 212 * @dev: device to free
213 * 213 *
214 * The function frees memory allocated for polling device and drops 214 * The function frees memory allocated for polling device and drops
215 * reference to the associated input device (if present). 215 * reference to the associated input device.
216 */ 216 */
217void input_free_polled_device(struct input_polled_dev *dev) 217void input_free_polled_device(struct input_polled_dev *dev)
218{ 218{
@@ -258,6 +258,15 @@ int input_register_polled_device(struct input_polled_dev *dev)
258 return error; 258 return error;
259 } 259 }
260 260
261 /*
262 * Take extra reference to the underlying input device so
263 * that it survives call to input_unregister_polled_device()
264 * and is deleted only after input_free_polled_device()
265 * has been invoked. This is needed to ease task of freeing
266 * sparse keymaps.
267 */
268 input_get_device(input);
269
261 return 0; 270 return 0;
262} 271}
263EXPORT_SYMBOL(input_register_polled_device); 272EXPORT_SYMBOL(input_register_polled_device);
@@ -269,8 +278,6 @@ EXPORT_SYMBOL(input_register_polled_device);
269 * The function unregisters previously registered polled input 278 * The function unregisters previously registered polled input
270 * device from input layer. Polling is stopped and device is 279 * device from input layer. Polling is stopped and device is
271 * ready to be freed with call to input_free_polled_device(). 280 * ready to be freed with call to input_free_polled_device().
272 * Callers should not attempt to access dev->input pointer
273 * after calling this function.
274 */ 281 */
275void input_unregister_polled_device(struct input_polled_dev *dev) 282void input_unregister_polled_device(struct input_polled_dev *dev)
276{ 283{
@@ -278,7 +285,6 @@ void input_unregister_polled_device(struct input_polled_dev *dev)
278 &input_polldev_attribute_group); 285 &input_polldev_attribute_group);
279 286
280 input_unregister_device(dev->input); 287 input_unregister_device(dev->input);
281 dev->input = NULL;
282} 288}
283EXPORT_SYMBOL(input_unregister_polled_device); 289EXPORT_SYMBOL(input_unregister_polled_device);
284 290