diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-03-09 01:37:10 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-03-09 02:19:15 -0500 |
commit | 58b939959d228681208ba997595411fddc860849 (patch) | |
tree | 3bfa2df2c811e14698e066f093a6dd7d75f45672 /drivers/input/input.c | |
parent | ec62e1c8dd2f9b2a833b48d4a2f58f0c5e07384c (diff) |
Input: scancode in get/set_keycodes should be unsigned
The HID layer has some scan codes of the form 0xffbc0000 for logitech
devices which do not work if scancode is typed as signed int, so we need
to switch to unsigned it instead. While at it keycode being signed does
not make much sense either.
Acked-by: Márton Németh <nm127@freemail.hu>
Acked-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r-- | drivers/input/input.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 41168d5f8c17..e2dd8858e19d 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -582,7 +582,8 @@ static int input_fetch_keycode(struct input_dev *dev, int scancode) | |||
582 | } | 582 | } |
583 | 583 | ||
584 | static int input_default_getkeycode(struct input_dev *dev, | 584 | static int input_default_getkeycode(struct input_dev *dev, |
585 | int scancode, int *keycode) | 585 | unsigned int scancode, |
586 | unsigned int *keycode) | ||
586 | { | 587 | { |
587 | if (!dev->keycodesize) | 588 | if (!dev->keycodesize) |
588 | return -EINVAL; | 589 | return -EINVAL; |
@@ -596,7 +597,8 @@ static int input_default_getkeycode(struct input_dev *dev, | |||
596 | } | 597 | } |
597 | 598 | ||
598 | static int input_default_setkeycode(struct input_dev *dev, | 599 | static int input_default_setkeycode(struct input_dev *dev, |
599 | int scancode, int keycode) | 600 | unsigned int scancode, |
601 | unsigned int keycode) | ||
600 | { | 602 | { |
601 | int old_keycode; | 603 | int old_keycode; |
602 | int i; | 604 | int i; |
@@ -654,11 +656,9 @@ static int input_default_setkeycode(struct input_dev *dev, | |||
654 | * This function should be called by anyone interested in retrieving current | 656 | * This function should be called by anyone interested in retrieving current |
655 | * keymap. Presently keyboard and evdev handlers use it. | 657 | * keymap. Presently keyboard and evdev handlers use it. |
656 | */ | 658 | */ |
657 | int input_get_keycode(struct input_dev *dev, int scancode, int *keycode) | 659 | int input_get_keycode(struct input_dev *dev, |
660 | unsigned int scancode, unsigned int *keycode) | ||
658 | { | 661 | { |
659 | if (scancode < 0) | ||
660 | return -EINVAL; | ||
661 | |||
662 | return dev->getkeycode(dev, scancode, keycode); | 662 | return dev->getkeycode(dev, scancode, keycode); |
663 | } | 663 | } |
664 | EXPORT_SYMBOL(input_get_keycode); | 664 | EXPORT_SYMBOL(input_get_keycode); |
@@ -672,16 +672,14 @@ EXPORT_SYMBOL(input_get_keycode); | |||
672 | * This function should be called by anyone needing to update current | 672 | * This function should be called by anyone needing to update current |
673 | * keymap. Presently keyboard and evdev handlers use it. | 673 | * keymap. Presently keyboard and evdev handlers use it. |
674 | */ | 674 | */ |
675 | int input_set_keycode(struct input_dev *dev, int scancode, int keycode) | 675 | int input_set_keycode(struct input_dev *dev, |
676 | unsigned int scancode, unsigned int keycode) | ||
676 | { | 677 | { |
677 | unsigned long flags; | 678 | unsigned long flags; |
678 | int old_keycode; | 679 | int old_keycode; |
679 | int retval; | 680 | int retval; |
680 | 681 | ||
681 | if (scancode < 0) | 682 | if (keycode > KEY_MAX) |
682 | return -EINVAL; | ||
683 | |||
684 | if (keycode < 0 || keycode > KEY_MAX) | ||
685 | return -EINVAL; | 683 | return -EINVAL; |
686 | 684 | ||
687 | spin_lock_irqsave(&dev->event_lock, flags); | 685 | spin_lock_irqsave(&dev->event_lock, flags); |