summaryrefslogtreecommitdiffstats
path: root/drivers/input/input.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-03-22 06:56:15 +0100
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-03-22 07:00:51 +0100
commit2e2e3b96d98d5c17e9c09bc6088df3e182a71814 (patch)
tree0ed49ca3ee60a9deb465d8aa4894365bd8d3030d /drivers/input/input.c
parentInput: update the status of the Multitouch X driver project (diff)
downloadlinux-2e2e3b96d98d5c17e9c09bc6088df3e182a71814.tar.xz
linux-2e2e3b96d98d5c17e9c09bc6088df3e182a71814.zip
Input: sparse-keymap - implement safer freeing of the keymap
Allow calling sparse_keymap_free() before unregistering input device whithout risk of racing with EVIOCGETKEYCODE and EVIOCSETKEYCODE. This makes life of drivers writers easier. Acked-by: Yong Wang <yong.y.wang@intel.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r--drivers/input/input.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index e2aad0a51826..be18fa99fa24 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -659,7 +659,14 @@ static int input_default_setkeycode(struct input_dev *dev,
int input_get_keycode(struct input_dev *dev,
unsigned int scancode, unsigned int *keycode)
{
- return dev->getkeycode(dev, scancode, keycode);
+ unsigned long flags;
+ int retval;
+
+ spin_lock_irqsave(&dev->event_lock, flags);
+ retval = dev->getkeycode(dev, scancode, keycode);
+ spin_unlock_irqrestore(&dev->event_lock, flags);
+
+ return retval;
}
EXPORT_SYMBOL(input_get_keycode);