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/platform | |
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/platform')
-rw-r--r-- | drivers/platform/x86/dell-wmi.c | 16 | ||||
-rw-r--r-- | drivers/platform/x86/hp-wmi.c | 15 | ||||
-rw-r--r-- | drivers/platform/x86/panasonic-laptop.c | 15 | ||||
-rw-r--r-- | drivers/platform/x86/topstar-laptop.c | 13 | ||||
-rw-r--r-- | drivers/platform/x86/toshiba_acpi.c | 17 |
5 files changed, 34 insertions, 42 deletions
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 | ||
143 | static struct input_dev *dell_wmi_input_dev; | 143 | static struct input_dev *dell_wmi_input_dev; |
144 | 144 | ||
145 | static struct key_entry *dell_wmi_get_entry_by_scancode(int code) | 145 | static 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 | ||
156 | static struct key_entry *dell_wmi_get_entry_by_keycode(int keycode) | 156 | static 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 | ||
167 | static int dell_wmi_getkeycode(struct input_dev *dev, int scancode, | 167 | static 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 | ||
180 | static int dell_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode) | 180 | static 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); | |||
278 | static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL); | 278 | static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL); |
279 | static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL); | 279 | static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL); |
280 | 280 | ||
281 | static struct key_entry *hp_wmi_get_entry_by_scancode(int code) | 281 | static 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 | ||
292 | static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode) | 292 | static 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 | ||
303 | static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode) | 303 | static 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 | ||
315 | static int hp_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode) | 316 | static 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 |
203 | static const int initial_keymap[KEYMAP_SIZE] = { | 203 | static 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 | ||
228 | struct pcc_keyinput { | 228 | struct 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 | ||
448 | static int pcc_getkeycode(struct input_dev *dev, int scancode, int *keycode) | 448 | static 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 | ||
460 | static int keymap_get_by_keycode(struct pcc_acpi *pcc, int keycode) | 461 | static 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 | ||
472 | static int pcc_setkeycode(struct input_dev *dev, int scancode, int keycode) | 473 | static 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 | ||
49 | static struct tps_key_entry *tps_get_key_by_scancode(int code) | 49 | static 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 | ||
60 | static struct tps_key_entry *tps_get_key_by_keycode(int code) | 60 | static 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 | ||
129 | static int topstar_getkeycode(struct input_dev *dev, int scancode, int *keycode) | 129 | static 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 | ||
140 | static int topstar_setkeycode(struct input_dev *dev, int scancode, int keycode) | 141 | static 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 | ||
748 | static struct key_entry *toshiba_acpi_get_entry_by_scancode(int code) | 748 | static 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 | ||
759 | static struct key_entry *toshiba_acpi_get_entry_by_keycode(int code) | 759 | static 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 | ||
770 | static int toshiba_acpi_getkeycode(struct input_dev *dev, int scancode, | 770 | static 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 | ||
783 | static int toshiba_acpi_setkeycode(struct input_dev *dev, int scancode, | 783 | static 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) { |