diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-03-22 01:56:15 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-03-22 02:00:51 -0400 |
commit | 2e2e3b96d98d5c17e9c09bc6088df3e182a71814 (patch) | |
tree | 0ed49ca3ee60a9deb465d8aa4894365bd8d3030d /drivers/input/input.c | |
parent | 13bad37b04c779d98983307a27f97e9caa36f9b1 (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.c | 9 |
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, | |||
659 | int input_get_keycode(struct input_dev *dev, | 659 | int input_get_keycode(struct input_dev *dev, |
660 | unsigned int scancode, unsigned int *keycode) | 660 | unsigned int scancode, unsigned int *keycode) |
661 | { | 661 | { |
662 | return dev->getkeycode(dev, scancode, keycode); | 662 | unsigned long flags; |
663 | int retval; | ||
664 | |||
665 | spin_lock_irqsave(&dev->event_lock, flags); | ||
666 | retval = dev->getkeycode(dev, scancode, keycode); | ||
667 | spin_unlock_irqrestore(&dev->event_lock, flags); | ||
668 | |||
669 | return retval; | ||
663 | } | 670 | } |
664 | EXPORT_SYMBOL(input_get_keycode); | 671 | EXPORT_SYMBOL(input_get_keycode); |
665 | 672 | ||