aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-03-09 01:37:10 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-03-09 02:19:15 -0500
commit58b939959d228681208ba997595411fddc860849 (patch)
tree3bfa2df2c811e14698e066f093a6dd7d75f45672
parentec62e1c8dd2f9b2a833b48d4a2f58f0c5e07384c (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>
-rw-r--r--drivers/hid/hid-input.c24
-rw-r--r--drivers/input/evdev.c2
-rw-r--r--drivers/input/input.c20
-rw-r--r--drivers/input/misc/ati_remote2.c14
-rw-r--r--drivers/input/misc/winbond-cir.c12
-rw-r--r--drivers/input/sparse-keymap.c6
-rw-r--r--drivers/media/IR/ir-keytable.c4
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-remote.c4
-rw-r--r--drivers/platform/x86/dell-wmi.c16
-rw-r--r--drivers/platform/x86/hp-wmi.c15
-rw-r--r--drivers/platform/x86/panasonic-laptop.c15
-rw-r--r--drivers/platform/x86/topstar-laptop.c13
-rw-r--r--drivers/platform/x86/toshiba_acpi.c17
-rw-r--r--include/linux/input.h20
14 files changed, 88 insertions, 94 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 79d9edd0bdfa..7a0d2e4661a1 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -68,22 +68,25 @@ static const struct {
68#define map_key_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \ 68#define map_key_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \
69 &max, EV_KEY, (c)) 69 &max, EV_KEY, (c))
70 70
71static inline int match_scancode(int code, int scancode) 71static inline int match_scancode(unsigned int code, unsigned int scancode)
72{ 72{
73 if (scancode == 0) 73 if (scancode == 0)
74 return 1; 74 return 1;
75 return ((code & (HID_USAGE_PAGE | HID_USAGE)) == scancode); 75
76 return (code & (HID_USAGE_PAGE | HID_USAGE)) == scancode;
76} 77}
77 78
78static inline int match_keycode(int code, int keycode) 79static inline int match_keycode(unsigned int code, unsigned int keycode)
79{ 80{
80 if (keycode == 0) 81 if (keycode == 0)
81 return 1; 82 return 1;
82 return (code == keycode); 83
84 return code == keycode;
83} 85}
84 86
85static struct hid_usage *hidinput_find_key(struct hid_device *hid, 87static struct hid_usage *hidinput_find_key(struct hid_device *hid,
86 int scancode, int keycode) 88 unsigned int scancode,
89 unsigned int keycode)
87{ 90{
88 int i, j, k; 91 int i, j, k;
89 struct hid_report *report; 92 struct hid_report *report;
@@ -105,8 +108,8 @@ static struct hid_usage *hidinput_find_key(struct hid_device *hid,
105 return NULL; 108 return NULL;
106} 109}
107 110
108static int hidinput_getkeycode(struct input_dev *dev, int scancode, 111static int hidinput_getkeycode(struct input_dev *dev,
109 int *keycode) 112 unsigned int scancode, unsigned int *keycode)
110{ 113{
111 struct hid_device *hid = input_get_drvdata(dev); 114 struct hid_device *hid = input_get_drvdata(dev);
112 struct hid_usage *usage; 115 struct hid_usage *usage;
@@ -119,16 +122,13 @@ static int hidinput_getkeycode(struct input_dev *dev, int scancode,
119 return -EINVAL; 122 return -EINVAL;
120} 123}
121 124
122static int hidinput_setkeycode(struct input_dev *dev, int scancode, 125static int hidinput_setkeycode(struct input_dev *dev,
123 int keycode) 126 unsigned int scancode, unsigned int keycode)
124{ 127{
125 struct hid_device *hid = input_get_drvdata(dev); 128 struct hid_device *hid = input_get_drvdata(dev);
126 struct hid_usage *usage; 129 struct hid_usage *usage;
127 int old_keycode; 130 int old_keycode;
128 131
129 if (keycode < 0 || keycode > KEY_MAX)
130 return -EINVAL;
131
132 usage = hidinput_find_key(hid, scancode, 0); 132 usage = hidinput_find_key(hid, scancode, 0);
133 if (usage) { 133 if (usage) {
134 old_keycode = usage->code; 134 old_keycode = usage->code;
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 9f9816baeb97..2ee6c7a68bdc 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -515,7 +515,7 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
515 struct input_absinfo abs; 515 struct input_absinfo abs;
516 struct ff_effect effect; 516 struct ff_effect effect;
517 int __user *ip = (int __user *)p; 517 int __user *ip = (int __user *)p;
518 int i, t, u, v; 518 unsigned int i, t, u, v;
519 int error; 519 int error;
520 520
521 switch (cmd) { 521 switch (cmd) {
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
584static int input_default_getkeycode(struct input_dev *dev, 584static 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
598static int input_default_setkeycode(struct input_dev *dev, 599static 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 */
657int input_get_keycode(struct input_dev *dev, int scancode, int *keycode) 659int 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}
664EXPORT_SYMBOL(input_get_keycode); 664EXPORT_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 */
675int input_set_keycode(struct input_dev *dev, int scancode, int keycode) 675int 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);
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
476static int ati_remote2_getkeycode(struct input_dev *idev, 476static 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
494static int ati_remote2_setkeycode(struct input_dev *idev, int scancode, int keycode) 495static 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
387static int 387static int
388wbcir_getkeycode(struct input_dev *dev, int scancode, int *keycode) 388wbcir_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
396static int 397static int
397wbcir_setkeycode(struct input_dev *dev, int sscancode, int keycode) 398wbcir_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)
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c
index fbd3987af57f..e6bde55e5203 100644
--- a/drivers/input/sparse-keymap.c
+++ b/drivers/input/sparse-keymap.c
@@ -64,7 +64,8 @@ struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev,
64EXPORT_SYMBOL(sparse_keymap_entry_from_keycode); 64EXPORT_SYMBOL(sparse_keymap_entry_from_keycode);
65 65
66static int sparse_keymap_getkeycode(struct input_dev *dev, 66static int sparse_keymap_getkeycode(struct input_dev *dev,
67 int scancode, int *keycode) 67 unsigned int scancode,
68 unsigned int *keycode)
68{ 69{
69 const struct key_entry *key = 70 const struct key_entry *key =
70 sparse_keymap_entry_from_scancode(dev, scancode); 71 sparse_keymap_entry_from_scancode(dev, scancode);
@@ -78,7 +79,8 @@ static int sparse_keymap_getkeycode(struct input_dev *dev,
78} 79}
79 80
80static int sparse_keymap_setkeycode(struct input_dev *dev, 81static int sparse_keymap_setkeycode(struct input_dev *dev,
81 int scancode, int keycode) 82 unsigned int scancode,
83 unsigned int keycode)
82{ 84{
83 struct key_entry *key; 85 struct key_entry *key;
84 int old_keycode; 86 int old_keycode;
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index 0903f539bf68..0a3b4ed38e48 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -123,7 +123,7 @@ static int ir_copy_table(struct ir_scancode_table *destin,
123 * If the key is not found, returns -EINVAL, otherwise, returns 0. 123 * If the key is not found, returns -EINVAL, otherwise, returns 0.
124 */ 124 */
125static int ir_getkeycode(struct input_dev *dev, 125static int ir_getkeycode(struct input_dev *dev,
126 int scancode, int *keycode) 126 unsigned int scancode, unsigned int *keycode)
127{ 127{
128 int elem; 128 int elem;
129 struct ir_input_dev *ir_dev = input_get_drvdata(dev); 129 struct ir_input_dev *ir_dev = input_get_drvdata(dev);
@@ -291,7 +291,7 @@ static int ir_insert_key(struct ir_scancode_table *rc_tab,
291 * If the key is not found, returns -EINVAL, otherwise, returns 0. 291 * If the key is not found, returns -EINVAL, otherwise, returns 0.
292 */ 292 */
293static int ir_setkeycode(struct input_dev *dev, 293static int ir_setkeycode(struct input_dev *dev,
294 int scancode, int keycode) 294 unsigned int scancode, unsigned int keycode)
295{ 295{
296 int rc = 0; 296 int rc = 0;
297 struct ir_input_dev *ir_dev = input_get_drvdata(dev); 297 struct ir_input_dev *ir_dev = input_get_drvdata(dev);
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
index a03ef7efec9a..852fe89539cf 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
@@ -9,7 +9,7 @@
9#include <linux/usb/input.h> 9#include <linux/usb/input.h>
10 10
11static int dvb_usb_getkeycode(struct input_dev *dev, 11static int dvb_usb_getkeycode(struct input_dev *dev,
12 int scancode, int *keycode) 12 unsigned int scancode, unsigned int *keycode)
13{ 13{
14 struct dvb_usb_device *d = input_get_drvdata(dev); 14 struct dvb_usb_device *d = input_get_drvdata(dev);
15 15
@@ -39,7 +39,7 @@ static int dvb_usb_getkeycode(struct input_dev *dev,
39} 39}
40 40
41static int dvb_usb_setkeycode(struct input_dev *dev, 41static int dvb_usb_setkeycode(struct input_dev *dev,
42 int scancode, int keycode) 42 unsigned int scancode, unsigned int keycode)
43{ 43{
44 struct dvb_usb_device *d = input_get_drvdata(dev); 44 struct dvb_usb_device *d = input_get_drvdata(dev);
45 45
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
index 1b1dddbd5744..bed764e3ea2a 100644
--- a/drivers/platform/x86/dell-wmi.c
+++ b/drivers/platform/x86/dell-wmi.c
@@ -142,7 +142,7 @@ static struct key_entry *dell_wmi_keymap = dell_legacy_wmi_keymap;
142 142
143static struct input_dev *dell_wmi_input_dev; 143static struct input_dev *dell_wmi_input_dev;
144 144
145static struct key_entry *dell_wmi_get_entry_by_scancode(int code) 145static struct key_entry *dell_wmi_get_entry_by_scancode(unsigned int code)
146{ 146{
147 struct key_entry *key; 147 struct key_entry *key;
148 148
@@ -153,7 +153,7 @@ static struct key_entry *dell_wmi_get_entry_by_scancode(int code)
153 return NULL; 153 return NULL;
154} 154}
155 155
156static struct key_entry *dell_wmi_get_entry_by_keycode(int keycode) 156static struct key_entry *dell_wmi_get_entry_by_keycode(unsigned int keycode)
157{ 157{
158 struct key_entry *key; 158 struct key_entry *key;
159 159
@@ -164,8 +164,8 @@ static struct key_entry *dell_wmi_get_entry_by_keycode(int keycode)
164 return NULL; 164 return NULL;
165} 165}
166 166
167static int dell_wmi_getkeycode(struct input_dev *dev, int scancode, 167static int dell_wmi_getkeycode(struct input_dev *dev,
168 int *keycode) 168 unsigned int scancode, unsigned int *keycode)
169{ 169{
170 struct key_entry *key = dell_wmi_get_entry_by_scancode(scancode); 170 struct key_entry *key = dell_wmi_get_entry_by_scancode(scancode);
171 171
@@ -177,13 +177,11 @@ static int dell_wmi_getkeycode(struct input_dev *dev, int scancode,
177 return -EINVAL; 177 return -EINVAL;
178} 178}
179 179
180static int dell_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode) 180static int dell_wmi_setkeycode(struct input_dev *dev,
181 unsigned int scancode, unsigned int keycode)
181{ 182{
182 struct key_entry *key; 183 struct key_entry *key;
183 int old_keycode; 184 unsigned int old_keycode;
184
185 if (keycode < 0 || keycode > KEY_MAX)
186 return -EINVAL;
187 185
188 key = dell_wmi_get_entry_by_scancode(scancode); 186 key = dell_wmi_get_entry_by_scancode(scancode);
189 if (key && key->type == KE_KEY) { 187 if (key && key->type == KE_KEY) {
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 7ccf33c08967..56086363becc 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -278,7 +278,7 @@ static DEVICE_ATTR(als, S_IRUGO | S_IWUSR, show_als, set_als);
278static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL); 278static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL);
279static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL); 279static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL);
280 280
281static struct key_entry *hp_wmi_get_entry_by_scancode(int code) 281static struct key_entry *hp_wmi_get_entry_by_scancode(unsigned int code)
282{ 282{
283 struct key_entry *key; 283 struct key_entry *key;
284 284
@@ -289,7 +289,7 @@ static struct key_entry *hp_wmi_get_entry_by_scancode(int code)
289 return NULL; 289 return NULL;
290} 290}
291 291
292static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode) 292static struct key_entry *hp_wmi_get_entry_by_keycode(unsigned int keycode)
293{ 293{
294 struct key_entry *key; 294 struct key_entry *key;
295 295
@@ -300,7 +300,8 @@ static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode)
300 return NULL; 300 return NULL;
301} 301}
302 302
303static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode) 303static int hp_wmi_getkeycode(struct input_dev *dev,
304 unsigned int scancode, unsigned int *keycode)
304{ 305{
305 struct key_entry *key = hp_wmi_get_entry_by_scancode(scancode); 306 struct key_entry *key = hp_wmi_get_entry_by_scancode(scancode);
306 307
@@ -312,13 +313,11 @@ static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode)
312 return -EINVAL; 313 return -EINVAL;
313} 314}
314 315
315static int hp_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode) 316static int hp_wmi_setkeycode(struct input_dev *dev,
317 unsigned int scancode, unsigned int keycode)
316{ 318{
317 struct key_entry *key; 319 struct key_entry *key;
318 int old_keycode; 320 unsigned int old_keycode;
319
320 if (keycode < 0 || keycode > KEY_MAX)
321 return -EINVAL;
322 321
323 key = hp_wmi_get_entry_by_scancode(scancode); 322 key = hp_wmi_get_entry_by_scancode(scancode);
324 if (key && key->type == KE_KEY) { 323 if (key && key->type == KE_KEY) {
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index fe7cf0188acc..c9fc479fc290 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -200,7 +200,7 @@ static struct acpi_driver acpi_pcc_driver = {
200}; 200};
201 201
202#define KEYMAP_SIZE 11 202#define KEYMAP_SIZE 11
203static const int initial_keymap[KEYMAP_SIZE] = { 203static const unsigned int initial_keymap[KEYMAP_SIZE] = {
204 /* 0 */ KEY_RESERVED, 204 /* 0 */ KEY_RESERVED,
205 /* 1 */ KEY_BRIGHTNESSDOWN, 205 /* 1 */ KEY_BRIGHTNESSDOWN,
206 /* 2 */ KEY_BRIGHTNESSUP, 206 /* 2 */ KEY_BRIGHTNESSUP,
@@ -222,7 +222,7 @@ struct pcc_acpi {
222 struct acpi_device *device; 222 struct acpi_device *device;
223 struct input_dev *input_dev; 223 struct input_dev *input_dev;
224 struct backlight_device *backlight; 224 struct backlight_device *backlight;
225 int keymap[KEYMAP_SIZE]; 225 unsigned int keymap[KEYMAP_SIZE];
226}; 226};
227 227
228struct pcc_keyinput { 228struct pcc_keyinput {
@@ -445,7 +445,8 @@ static struct attribute_group pcc_attr_group = {
445 445
446/* hotkey input device driver */ 446/* hotkey input device driver */
447 447
448static int pcc_getkeycode(struct input_dev *dev, int scancode, int *keycode) 448static int pcc_getkeycode(struct input_dev *dev,
449 unsigned int scancode, unsigned int *keycode)
449{ 450{
450 struct pcc_acpi *pcc = input_get_drvdata(dev); 451 struct pcc_acpi *pcc = input_get_drvdata(dev);
451 452
@@ -457,7 +458,7 @@ static int pcc_getkeycode(struct input_dev *dev, int scancode, int *keycode)
457 return 0; 458 return 0;
458} 459}
459 460
460static int keymap_get_by_keycode(struct pcc_acpi *pcc, int keycode) 461static int keymap_get_by_keycode(struct pcc_acpi *pcc, unsigned int keycode)
461{ 462{
462 int i; 463 int i;
463 464
@@ -469,7 +470,8 @@ static int keymap_get_by_keycode(struct pcc_acpi *pcc, int keycode)
469 return 0; 470 return 0;
470} 471}
471 472
472static int pcc_setkeycode(struct input_dev *dev, int scancode, int keycode) 473static int pcc_setkeycode(struct input_dev *dev,
474 unsigned int scancode, unsigned int keycode)
473{ 475{
474 struct pcc_acpi *pcc = input_get_drvdata(dev); 476 struct pcc_acpi *pcc = input_get_drvdata(dev);
475 int oldkeycode; 477 int oldkeycode;
@@ -477,9 +479,6 @@ static int pcc_setkeycode(struct input_dev *dev, int scancode, int keycode)
477 if (scancode >= ARRAY_SIZE(pcc->keymap)) 479 if (scancode >= ARRAY_SIZE(pcc->keymap))
478 return -EINVAL; 480 return -EINVAL;
479 481
480 if (keycode < 0 || keycode > KEY_MAX)
481 return -EINVAL;
482
483 oldkeycode = pcc->keymap[scancode]; 482 oldkeycode = pcc->keymap[scancode];
484 pcc->keymap[scancode] = keycode; 483 pcc->keymap[scancode] = keycode;
485 484
diff --git a/drivers/platform/x86/topstar-laptop.c b/drivers/platform/x86/topstar-laptop.c
index 02f3d4e9e666..4d6516fded7e 100644
--- a/drivers/platform/x86/topstar-laptop.c
+++ b/drivers/platform/x86/topstar-laptop.c
@@ -46,7 +46,7 @@ static struct tps_key_entry topstar_keymap[] = {
46 { } 46 { }
47}; 47};
48 48
49static struct tps_key_entry *tps_get_key_by_scancode(int code) 49static struct tps_key_entry *tps_get_key_by_scancode(unsigned int code)
50{ 50{
51 struct tps_key_entry *key; 51 struct tps_key_entry *key;
52 52
@@ -57,7 +57,7 @@ static struct tps_key_entry *tps_get_key_by_scancode(int code)
57 return NULL; 57 return NULL;
58} 58}
59 59
60static struct tps_key_entry *tps_get_key_by_keycode(int code) 60static struct tps_key_entry *tps_get_key_by_keycode(unsigned int code)
61{ 61{
62 struct tps_key_entry *key; 62 struct tps_key_entry *key;
63 63
@@ -126,7 +126,8 @@ static int acpi_topstar_fncx_switch(struct acpi_device *device, bool state)
126 return 0; 126 return 0;
127} 127}
128 128
129static int topstar_getkeycode(struct input_dev *dev, int scancode, int *keycode) 129static int topstar_getkeycode(struct input_dev *dev,
130 unsigned int scancode, unsigned int *keycode)
130{ 131{
131 struct tps_key_entry *key = tps_get_key_by_scancode(scancode); 132 struct tps_key_entry *key = tps_get_key_by_scancode(scancode);
132 133
@@ -137,14 +138,12 @@ static int topstar_getkeycode(struct input_dev *dev, int scancode, int *keycode)
137 return 0; 138 return 0;
138} 139}
139 140
140static int topstar_setkeycode(struct input_dev *dev, int scancode, int keycode) 141static int topstar_setkeycode(struct input_dev *dev,
142 unsigned int scancode, unsigned int keycode)
141{ 143{
142 struct tps_key_entry *key; 144 struct tps_key_entry *key;
143 int old_keycode; 145 int old_keycode;
144 146
145 if (keycode < 0 || keycode > KEY_MAX)
146 return -EINVAL;
147
148 key = tps_get_key_by_scancode(scancode); 147 key = tps_get_key_by_scancode(scancode);
149 148
150 if (!key) 149 if (!key)
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 405b969734d6..789240d1b577 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -745,7 +745,7 @@ static struct backlight_ops toshiba_backlight_data = {
745 .update_status = set_lcd_status, 745 .update_status = set_lcd_status,
746}; 746};
747 747
748static struct key_entry *toshiba_acpi_get_entry_by_scancode(int code) 748static struct key_entry *toshiba_acpi_get_entry_by_scancode(unsigned int code)
749{ 749{
750 struct key_entry *key; 750 struct key_entry *key;
751 751
@@ -756,7 +756,7 @@ static struct key_entry *toshiba_acpi_get_entry_by_scancode(int code)
756 return NULL; 756 return NULL;
757} 757}
758 758
759static struct key_entry *toshiba_acpi_get_entry_by_keycode(int code) 759static struct key_entry *toshiba_acpi_get_entry_by_keycode(unsigned int code)
760{ 760{
761 struct key_entry *key; 761 struct key_entry *key;
762 762
@@ -767,8 +767,8 @@ static struct key_entry *toshiba_acpi_get_entry_by_keycode(int code)
767 return NULL; 767 return NULL;
768} 768}
769 769
770static int toshiba_acpi_getkeycode(struct input_dev *dev, int scancode, 770static int toshiba_acpi_getkeycode(struct input_dev *dev,
771 int *keycode) 771 unsigned int scancode, unsigned int *keycode)
772{ 772{
773 struct key_entry *key = toshiba_acpi_get_entry_by_scancode(scancode); 773 struct key_entry *key = toshiba_acpi_get_entry_by_scancode(scancode);
774 774
@@ -780,14 +780,11 @@ static int toshiba_acpi_getkeycode(struct input_dev *dev, int scancode,
780 return -EINVAL; 780 return -EINVAL;
781} 781}
782 782
783static int toshiba_acpi_setkeycode(struct input_dev *dev, int scancode, 783static int toshiba_acpi_setkeycode(struct input_dev *dev,
784 int keycode) 784 unsigned int scancode, unsigned int keycode)
785{ 785{
786 struct key_entry *key; 786 struct key_entry *key;
787 int old_keycode; 787 unsigned int old_keycode;
788
789 if (keycode < 0 || keycode > KEY_MAX)
790 return -EINVAL;
791 788
792 key = toshiba_acpi_get_entry_by_scancode(scancode); 789 key = toshiba_acpi_get_entry_by_scancode(scancode);
793 if (key && key->type == KE_KEY) { 790 if (key && key->type == KE_KEY) {
diff --git a/include/linux/input.h b/include/linux/input.h
index dc24effb6d0e..7ed2251b33f1 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -58,10 +58,10 @@ struct input_absinfo {
58 58
59#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ 59#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */
60#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ 60#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */
61#define EVIOCGREP _IOR('E', 0x03, int[2]) /* get repeat settings */ 61#define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */
62#define EVIOCSREP _IOW('E', 0x03, int[2]) /* set repeat settings */ 62#define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */
63#define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */ 63#define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */
64#define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */ 64#define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */
65 65
66#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ 66#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */
67#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ 67#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */
@@ -1142,8 +1142,10 @@ struct input_dev {
1142 unsigned int keycodemax; 1142 unsigned int keycodemax;
1143 unsigned int keycodesize; 1143 unsigned int keycodesize;
1144 void *keycode; 1144 void *keycode;
1145 int (*setkeycode)(struct input_dev *dev, int scancode, int keycode); 1145 int (*setkeycode)(struct input_dev *dev,
1146 int (*getkeycode)(struct input_dev *dev, int scancode, int *keycode); 1146 unsigned int scancode, unsigned int keycode);
1147 int (*getkeycode)(struct input_dev *dev,
1148 unsigned int scancode, unsigned int *keycode);
1147 1149
1148 struct ff_device *ff; 1150 struct ff_device *ff;
1149 1151
@@ -1415,8 +1417,10 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min
1415 dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); 1417 dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis);
1416} 1418}
1417 1419
1418int input_get_keycode(struct input_dev *dev, int scancode, int *keycode); 1420int input_get_keycode(struct input_dev *dev,
1419int input_set_keycode(struct input_dev *dev, int scancode, int keycode); 1421 unsigned int scancode, unsigned int *keycode);
1422int input_set_keycode(struct input_dev *dev,
1423 unsigned int scancode, unsigned int keycode);
1420 1424
1421extern struct class input_class; 1425extern struct class input_class;
1422 1426