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/misc | |
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/misc')
-rw-r--r-- | drivers/input/misc/ati_remote2.c | 14 | ||||
-rw-r--r-- | drivers/input/misc/winbond-cir.c | 12 |
2 files changed, 12 insertions, 14 deletions
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c index 0501f0e65157..15be5430bc6d 100644 --- a/drivers/input/misc/ati_remote2.c +++ b/drivers/input/misc/ati_remote2.c | |||
@@ -474,10 +474,11 @@ static void ati_remote2_complete_key(struct urb *urb) | |||
474 | } | 474 | } |
475 | 475 | ||
476 | static int ati_remote2_getkeycode(struct input_dev *idev, | 476 | static int ati_remote2_getkeycode(struct input_dev *idev, |
477 | int scancode, int *keycode) | 477 | unsigned int scancode, unsigned int *keycode) |
478 | { | 478 | { |
479 | struct ati_remote2 *ar2 = input_get_drvdata(idev); | 479 | struct ati_remote2 *ar2 = input_get_drvdata(idev); |
480 | int index, mode; | 480 | unsigned int mode; |
481 | int index; | ||
481 | 482 | ||
482 | mode = scancode >> 8; | 483 | mode = scancode >> 8; |
483 | if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask)) | 484 | if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask)) |
@@ -491,10 +492,12 @@ static int ati_remote2_getkeycode(struct input_dev *idev, | |||
491 | return 0; | 492 | return 0; |
492 | } | 493 | } |
493 | 494 | ||
494 | static int ati_remote2_setkeycode(struct input_dev *idev, int scancode, int keycode) | 495 | static int ati_remote2_setkeycode(struct input_dev *idev, |
496 | unsigned int scancode, unsigned int keycode) | ||
495 | { | 497 | { |
496 | struct ati_remote2 *ar2 = input_get_drvdata(idev); | 498 | struct ati_remote2 *ar2 = input_get_drvdata(idev); |
497 | int index, mode, old_keycode; | 499 | unsigned int mode, old_keycode; |
500 | int index; | ||
498 | 501 | ||
499 | mode = scancode >> 8; | 502 | mode = scancode >> 8; |
500 | if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask)) | 503 | if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask)) |
@@ -504,9 +507,6 @@ static int ati_remote2_setkeycode(struct input_dev *idev, int scancode, int keyc | |||
504 | if (index < 0) | 507 | if (index < 0) |
505 | return -EINVAL; | 508 | return -EINVAL; |
506 | 509 | ||
507 | if (keycode < KEY_RESERVED || keycode > KEY_MAX) | ||
508 | return -EINVAL; | ||
509 | |||
510 | old_keycode = ar2->keycode[mode][index]; | 510 | old_keycode = ar2->keycode[mode][index]; |
511 | ar2->keycode[mode][index] = keycode; | 511 | ar2->keycode[mode][index] = keycode; |
512 | __set_bit(keycode, idev->keybit); | 512 | __set_bit(keycode, idev->keybit); |
diff --git a/drivers/input/misc/winbond-cir.c b/drivers/input/misc/winbond-cir.c index cbec3dfdd42b..9c155a43abc2 100644 --- a/drivers/input/misc/winbond-cir.c +++ b/drivers/input/misc/winbond-cir.c | |||
@@ -385,26 +385,24 @@ wbcir_do_getkeycode(struct wbcir_data *data, u32 scancode) | |||
385 | } | 385 | } |
386 | 386 | ||
387 | static int | 387 | static int |
388 | wbcir_getkeycode(struct input_dev *dev, int scancode, int *keycode) | 388 | wbcir_getkeycode(struct input_dev *dev, |
389 | unsigned int scancode, unsigned int *keycode) | ||
389 | { | 390 | { |
390 | struct wbcir_data *data = input_get_drvdata(dev); | 391 | struct wbcir_data *data = input_get_drvdata(dev); |
391 | 392 | ||
392 | *keycode = (int)wbcir_do_getkeycode(data, (u32)scancode); | 393 | *keycode = wbcir_do_getkeycode(data, scancode); |
393 | return 0; | 394 | return 0; |
394 | } | 395 | } |
395 | 396 | ||
396 | static int | 397 | static int |
397 | wbcir_setkeycode(struct input_dev *dev, int sscancode, int keycode) | 398 | wbcir_setkeycode(struct input_dev *dev, |
399 | unsigned int scancode, unsigned int keycode) | ||
398 | { | 400 | { |
399 | struct wbcir_data *data = input_get_drvdata(dev); | 401 | struct wbcir_data *data = input_get_drvdata(dev); |
400 | struct wbcir_keyentry *keyentry; | 402 | struct wbcir_keyentry *keyentry; |
401 | struct wbcir_keyentry *new_keyentry; | 403 | struct wbcir_keyentry *new_keyentry; |
402 | unsigned long flags; | 404 | unsigned long flags; |
403 | unsigned int old_keycode = KEY_RESERVED; | 405 | unsigned int old_keycode = KEY_RESERVED; |
404 | u32 scancode = (u32)sscancode; | ||
405 | |||
406 | if (keycode < 0 || keycode > KEY_MAX) | ||
407 | return -EINVAL; | ||
408 | 406 | ||
409 | new_keyentry = kmalloc(sizeof(*new_keyentry), GFP_KERNEL); | 407 | new_keyentry = kmalloc(sizeof(*new_keyentry), GFP_KERNEL); |
410 | if (!new_keyentry) | 408 | if (!new_keyentry) |