summaryrefslogtreecommitdiffstats
path: root/drivers/input/input.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-03-21 22:56:15 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-03-21 23:00:51 -0700
commit2e2e3b96d98d5c17e9c09bc6088df3e182a71814 (patch)
tree0ed49ca3ee60a9deb465d8aa4894365bd8d3030d /drivers/input/input.c
parent13bad37b04c779d98983307a27f97e9caa36f9b1 (diff)
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 e2aad0a5182..be18fa99fa2 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);