]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/commitdiff
Input: scancode in get/set_keycodes should be unsigned
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 9 Mar 2010 06:37:10 +0000 (22:37 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 9 Mar 2010 07:19:15 +0000 (23:19 -0800)
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>
14 files changed:
drivers/hid/hid-input.c
drivers/input/evdev.c
drivers/input/input.c
drivers/input/misc/ati_remote2.c
drivers/input/misc/winbond-cir.c
drivers/input/sparse-keymap.c
drivers/media/IR/ir-keytable.c
drivers/media/dvb/dvb-usb/dvb-usb-remote.c
drivers/platform/x86/dell-wmi.c
drivers/platform/x86/hp-wmi.c
drivers/platform/x86/panasonic-laptop.c
drivers/platform/x86/topstar-laptop.c
drivers/platform/x86/toshiba_acpi.c
include/linux/input.h

index 79d9edd0bdfa489cd075164d36464a15e6267b92..7a0d2e4661a1244b02de5b511389fc1ea7bb68d5 100644 (file)
@@ -68,22 +68,25 @@ static const struct {
 #define map_key_clear(c)       hid_map_usage_clear(hidinput, usage, &bit, \
                &max, EV_KEY, (c))
 
-static inline int match_scancode(int code, int scancode)
+static inline int match_scancode(unsigned int code, unsigned int scancode)
 {
        if (scancode == 0)
                return 1;
-       return ((code & (HID_USAGE_PAGE | HID_USAGE)) == scancode);
+
+       return (code & (HID_USAGE_PAGE | HID_USAGE)) == scancode;
 }
 
-static inline int match_keycode(int code, int keycode)
+static inline int match_keycode(unsigned int code, unsigned int keycode)
 {
        if (keycode == 0)
                return 1;
-       return (code == keycode);
+
+       return code == keycode;
 }
 
 static struct hid_usage *hidinput_find_key(struct hid_device *hid,
-               int scancode, int keycode)
+                                          unsigned int scancode,
+                                          unsigned int keycode)
 {
        int i, j, k;
        struct hid_report *report;
@@ -105,8 +108,8 @@ static struct hid_usage *hidinput_find_key(struct hid_device *hid,
        return NULL;
 }
 
-static int hidinput_getkeycode(struct input_dev *dev, int scancode,
-                               int *keycode)
+static int hidinput_getkeycode(struct input_dev *dev,
+                              unsigned int scancode, unsigned int *keycode)
 {
        struct hid_device *hid = input_get_drvdata(dev);
        struct hid_usage *usage;
@@ -119,16 +122,13 @@ static int hidinput_getkeycode(struct input_dev *dev, int scancode,
        return -EINVAL;
 }
 
-static int hidinput_setkeycode(struct input_dev *dev, int scancode,
-                               int keycode)
+static int hidinput_setkeycode(struct input_dev *dev,
+                              unsigned int scancode, unsigned int keycode)
 {
        struct hid_device *hid = input_get_drvdata(dev);
        struct hid_usage *usage;
        int old_keycode;
 
-       if (keycode < 0 || keycode > KEY_MAX)
-               return -EINVAL;
-
        usage = hidinput_find_key(hid, scancode, 0);
        if (usage) {
                old_keycode = usage->code;
index 9f9816baeb97bed74092781e35373ecae1a996ab..2ee6c7a68bdccf4c9cf6c330f824d341f0a69302 100644 (file)
@@ -515,7 +515,7 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
        struct input_absinfo abs;
        struct ff_effect effect;
        int __user *ip = (int __user *)p;
-       int i, t, u, v;
+       unsigned int i, t, u, v;
        int error;
 
        switch (cmd) {
index 41168d5f8c17bb0d1847b03695db8c095565ade5..e2dd8858e19d31876fd4406b7142c8ce487aa49f 100644 (file)
@@ -582,7 +582,8 @@ static int input_fetch_keycode(struct input_dev *dev, int scancode)
 }
 
 static int input_default_getkeycode(struct input_dev *dev,
-                                   int scancode, int *keycode)
+                                   unsigned int scancode,
+                                   unsigned int *keycode)
 {
        if (!dev->keycodesize)
                return -EINVAL;
@@ -596,7 +597,8 @@ static int input_default_getkeycode(struct input_dev *dev,
 }
 
 static int input_default_setkeycode(struct input_dev *dev,
-                                   int scancode, int keycode)
+                                   unsigned int scancode,
+                                   unsigned int keycode)
 {
        int old_keycode;
        int i;
@@ -654,11 +656,9 @@ static int input_default_setkeycode(struct input_dev *dev,
  * This function should be called by anyone interested in retrieving current
  * keymap. Presently keyboard and evdev handlers use it.
  */
-int input_get_keycode(struct input_dev *dev, int scancode, int *keycode)
+int input_get_keycode(struct input_dev *dev,
+                     unsigned int scancode, unsigned int *keycode)
 {
-       if (scancode < 0)
-               return -EINVAL;
-
        return dev->getkeycode(dev, scancode, keycode);
 }
 EXPORT_SYMBOL(input_get_keycode);
@@ -672,16 +672,14 @@ EXPORT_SYMBOL(input_get_keycode);
  * This function should be called by anyone needing to update current
  * keymap. Presently keyboard and evdev handlers use it.
  */
-int input_set_keycode(struct input_dev *dev, int scancode, int keycode)
+int input_set_keycode(struct input_dev *dev,
+                     unsigned int scancode, unsigned int keycode)
 {
        unsigned long flags;
        int old_keycode;
        int retval;
 
-       if (scancode < 0)
-               return -EINVAL;
-
-       if (keycode < 0 || keycode > KEY_MAX)
+       if (keycode > KEY_MAX)
                return -EINVAL;
 
        spin_lock_irqsave(&dev->event_lock, flags);
index 0501f0e65157bdfb1e1d90fd7ff1846d10c97eb0..15be5430bc6d6010bc3e4e3bcc93fe7bc9d696d4 100644 (file)
@@ -474,10 +474,11 @@ static void ati_remote2_complete_key(struct urb *urb)
 }
 
 static int ati_remote2_getkeycode(struct input_dev *idev,
-                                 int scancode, int *keycode)
+                                 unsigned int scancode, unsigned int *keycode)
 {
        struct ati_remote2 *ar2 = input_get_drvdata(idev);
-       int index, mode;
+       unsigned int mode;
+       int index;
 
        mode = scancode >> 8;
        if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask))
@@ -491,10 +492,12 @@ static int ati_remote2_getkeycode(struct input_dev *idev,
        return 0;
 }
 
-static int ati_remote2_setkeycode(struct input_dev *idev, int scancode, int keycode)
+static int ati_remote2_setkeycode(struct input_dev *idev,
+                                 unsigned int scancode, unsigned int keycode)
 {
        struct ati_remote2 *ar2 = input_get_drvdata(idev);
-       int index, mode, old_keycode;
+       unsigned int mode, old_keycode;
+       int index;
 
        mode = scancode >> 8;
        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
        if (index < 0)
                return -EINVAL;
 
-       if (keycode < KEY_RESERVED || keycode > KEY_MAX)
-               return -EINVAL;
-
        old_keycode = ar2->keycode[mode][index];
        ar2->keycode[mode][index] = keycode;
        __set_bit(keycode, idev->keybit);
index cbec3dfdd42b5373de0865edfb1a49c4440468bb..9c155a43abc2afd811348f88808952cd9be59c75 100644 (file)
@@ -385,26 +385,24 @@ wbcir_do_getkeycode(struct wbcir_data *data, u32 scancode)
 }
 
 static int
-wbcir_getkeycode(struct input_dev *dev, int scancode, int *keycode)
+wbcir_getkeycode(struct input_dev *dev,
+                unsigned int scancode, unsigned int *keycode)
 {
        struct wbcir_data *data = input_get_drvdata(dev);
 
-       *keycode = (int)wbcir_do_getkeycode(data, (u32)scancode);
+       *keycode = wbcir_do_getkeycode(data, scancode);
        return 0;
 }
 
 static int
-wbcir_setkeycode(struct input_dev *dev, int sscancode, int keycode)
+wbcir_setkeycode(struct input_dev *dev,
+                unsigned int scancode, unsigned int keycode)
 {
        struct wbcir_data *data = input_get_drvdata(dev);
        struct wbcir_keyentry *keyentry;
        struct wbcir_keyentry *new_keyentry;
        unsigned long flags;
        unsigned int old_keycode = KEY_RESERVED;
-       u32 scancode = (u32)sscancode;
-
-       if (keycode < 0 || keycode > KEY_MAX)
-               return -EINVAL;
 
        new_keyentry = kmalloc(sizeof(*new_keyentry), GFP_KERNEL);
        if (!new_keyentry)
index fbd3987af57f7291ad12488567772f8f404b319f..e6bde55e5203c06f651dfaa7e6ef7f1cfc1633a8 100644 (file)
@@ -64,7 +64,8 @@ struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev,
 EXPORT_SYMBOL(sparse_keymap_entry_from_keycode);
 
 static int sparse_keymap_getkeycode(struct input_dev *dev,
-                                   int scancode, int *keycode)
+                                   unsigned int scancode,
+                                   unsigned int *keycode)
 {
        const struct key_entry *key =
                        sparse_keymap_entry_from_scancode(dev, scancode);
@@ -78,7 +79,8 @@ static int sparse_keymap_getkeycode(struct input_dev *dev,
 }
 
 static int sparse_keymap_setkeycode(struct input_dev *dev,
-                                   int scancode, int keycode)
+                                   unsigned int scancode,
+                                   unsigned int keycode)
 {
        struct key_entry *key;
        int old_keycode;
index 0903f539bf685a89027f6fc309a3703f4687a688..0a3b4ed38e488ebd3015042c2b8a5b0c1b0160ba 100644 (file)
@@ -123,7 +123,7 @@ static int ir_copy_table(struct ir_scancode_table *destin,
  * If the key is not found, returns -EINVAL, otherwise, returns 0.
  */
 static int ir_getkeycode(struct input_dev *dev,
-                        int scancode, int *keycode)
+                        unsigned int scancode, unsigned int *keycode)
 {
        int elem;
        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,
  * If the key is not found, returns -EINVAL, otherwise, returns 0.
  */
 static int ir_setkeycode(struct input_dev *dev,
-                        int scancode, int keycode)
+                        unsigned int scancode, unsigned int keycode)
 {
        int rc = 0;
        struct ir_input_dev *ir_dev = input_get_drvdata(dev);
index a03ef7efec9abcba1a11b4a1d332012841b37ba6..852fe89539cfdb538cbe67b2b3b7cba940d72153 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/usb/input.h>
 
 static int dvb_usb_getkeycode(struct input_dev *dev,
-                                   int scancode, int *keycode)
+                               unsigned int scancode, unsigned int *keycode)
 {
        struct dvb_usb_device *d = input_get_drvdata(dev);
 
@@ -39,7 +39,7 @@ static int dvb_usb_getkeycode(struct input_dev *dev,
 }
 
 static int dvb_usb_setkeycode(struct input_dev *dev,
-                                   int scancode, int keycode)
+                               unsigned int scancode, unsigned int keycode)
 {
        struct dvb_usb_device *d = input_get_drvdata(dev);
 
index 1b1dddbd5744e85d0a1123ac27d0a7379190eb13..bed764e3ea2a03f5892194d8e992bc4ccf9987c1 100644 (file)
@@ -142,7 +142,7 @@ static struct key_entry *dell_wmi_keymap = dell_legacy_wmi_keymap;
 
 static struct input_dev *dell_wmi_input_dev;
 
-static struct key_entry *dell_wmi_get_entry_by_scancode(int code)
+static struct key_entry *dell_wmi_get_entry_by_scancode(unsigned int code)
 {
        struct key_entry *key;
 
@@ -153,7 +153,7 @@ static struct key_entry *dell_wmi_get_entry_by_scancode(int code)
        return NULL;
 }
 
-static struct key_entry *dell_wmi_get_entry_by_keycode(int keycode)
+static struct key_entry *dell_wmi_get_entry_by_keycode(unsigned int keycode)
 {
        struct key_entry *key;
 
@@ -164,8 +164,8 @@ static struct key_entry *dell_wmi_get_entry_by_keycode(int keycode)
        return NULL;
 }
 
-static int dell_wmi_getkeycode(struct input_dev *dev, int scancode,
-                              int *keycode)
+static int dell_wmi_getkeycode(struct input_dev *dev,
+                               unsigned int scancode, unsigned int *keycode)
 {
        struct key_entry *key = dell_wmi_get_entry_by_scancode(scancode);
 
@@ -177,13 +177,11 @@ static int dell_wmi_getkeycode(struct input_dev *dev, int scancode,
        return -EINVAL;
 }
 
-static int dell_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode)
+static int dell_wmi_setkeycode(struct input_dev *dev,
+                               unsigned int scancode, unsigned int keycode)
 {
        struct key_entry *key;
-       int old_keycode;
-
-       if (keycode < 0 || keycode > KEY_MAX)
-               return -EINVAL;
+       unsigned int old_keycode;
 
        key = dell_wmi_get_entry_by_scancode(scancode);
        if (key && key->type == KE_KEY) {
index 7ccf33c08967a2ca094bfa8b1e400eebc4f0228c..56086363becc21fba3dfcd1f8f31397881d5d76d 100644 (file)
@@ -278,7 +278,7 @@ static DEVICE_ATTR(als, S_IRUGO | S_IWUSR, show_als, set_als);
 static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL);
 static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL);
 
-static struct key_entry *hp_wmi_get_entry_by_scancode(int code)
+static struct key_entry *hp_wmi_get_entry_by_scancode(unsigned int code)
 {
        struct key_entry *key;
 
@@ -289,7 +289,7 @@ static struct key_entry *hp_wmi_get_entry_by_scancode(int code)
        return NULL;
 }
 
-static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode)
+static struct key_entry *hp_wmi_get_entry_by_keycode(unsigned int keycode)
 {
        struct key_entry *key;
 
@@ -300,7 +300,8 @@ static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode)
        return NULL;
 }
 
-static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode)
+static int hp_wmi_getkeycode(struct input_dev *dev,
+                            unsigned int scancode, unsigned int *keycode)
 {
        struct key_entry *key = hp_wmi_get_entry_by_scancode(scancode);
 
@@ -312,13 +313,11 @@ static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode)
        return -EINVAL;
 }
 
-static int hp_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode)
+static int hp_wmi_setkeycode(struct input_dev *dev,
+                            unsigned int scancode, unsigned int keycode)
 {
        struct key_entry *key;
-       int old_keycode;
-
-       if (keycode < 0 || keycode > KEY_MAX)
-               return -EINVAL;
+       unsigned int old_keycode;
 
        key = hp_wmi_get_entry_by_scancode(scancode);
        if (key && key->type == KE_KEY) {
index fe7cf0188acc12df1794ebf9c8107de5f1bac7f6..c9fc479fc290ee5bb5266cd25f6a23397e7bf1da 100644 (file)
@@ -200,7 +200,7 @@ static struct acpi_driver acpi_pcc_driver = {
 };
 
 #define KEYMAP_SIZE            11
-static const int initial_keymap[KEYMAP_SIZE] = {
+static const unsigned int initial_keymap[KEYMAP_SIZE] = {
        /*  0 */ KEY_RESERVED,
        /*  1 */ KEY_BRIGHTNESSDOWN,
        /*  2 */ KEY_BRIGHTNESSUP,
@@ -222,7 +222,7 @@ struct pcc_acpi {
        struct acpi_device      *device;
        struct input_dev        *input_dev;
        struct backlight_device *backlight;
-       int                     keymap[KEYMAP_SIZE];
+       unsigned int            keymap[KEYMAP_SIZE];
 };
 
 struct pcc_keyinput {
@@ -445,7 +445,8 @@ static struct attribute_group pcc_attr_group = {
 
 /* hotkey input device driver */
 
-static int pcc_getkeycode(struct input_dev *dev, int scancode, int *keycode)
+static int pcc_getkeycode(struct input_dev *dev,
+                         unsigned int scancode, unsigned int *keycode)
 {
        struct pcc_acpi *pcc = input_get_drvdata(dev);
 
@@ -457,7 +458,7 @@ static int pcc_getkeycode(struct input_dev *dev, int scancode, int *keycode)
        return 0;
 }
 
-static int keymap_get_by_keycode(struct pcc_acpi *pcc, int keycode)
+static int keymap_get_by_keycode(struct pcc_acpi *pcc, unsigned int keycode)
 {
        int i;
 
@@ -469,7 +470,8 @@ static int keymap_get_by_keycode(struct pcc_acpi *pcc, int keycode)
        return 0;
 }
 
-static int pcc_setkeycode(struct input_dev *dev, int scancode, int keycode)
+static int pcc_setkeycode(struct input_dev *dev,
+                         unsigned int scancode, unsigned int keycode)
 {
        struct pcc_acpi *pcc = input_get_drvdata(dev);
        int oldkeycode;
@@ -477,9 +479,6 @@ static int pcc_setkeycode(struct input_dev *dev, int scancode, int keycode)
        if (scancode >= ARRAY_SIZE(pcc->keymap))
                return -EINVAL;
 
-       if (keycode < 0 || keycode > KEY_MAX)
-               return -EINVAL;
-
        oldkeycode = pcc->keymap[scancode];
        pcc->keymap[scancode] = keycode;
 
index 02f3d4e9e666ddc127275d28a462388382fd7e1c..4d6516fded7eeaea8f5f98ebf19254cd17363d7b 100644 (file)
@@ -46,7 +46,7 @@ static struct tps_key_entry topstar_keymap[] = {
        { }
 };
 
-static struct tps_key_entry *tps_get_key_by_scancode(int code)
+static struct tps_key_entry *tps_get_key_by_scancode(unsigned int code)
 {
        struct tps_key_entry *key;
 
@@ -57,7 +57,7 @@ static struct tps_key_entry *tps_get_key_by_scancode(int code)
        return NULL;
 }
 
-static struct tps_key_entry *tps_get_key_by_keycode(int code)
+static struct tps_key_entry *tps_get_key_by_keycode(unsigned int code)
 {
        struct tps_key_entry *key;
 
@@ -126,7 +126,8 @@ static int acpi_topstar_fncx_switch(struct acpi_device *device, bool state)
        return 0;
 }
 
-static int topstar_getkeycode(struct input_dev *dev, int scancode, int *keycode)
+static int topstar_getkeycode(struct input_dev *dev,
+                               unsigned int scancode, unsigned int *keycode)
 {
        struct tps_key_entry *key = tps_get_key_by_scancode(scancode);
 
@@ -137,14 +138,12 @@ static int topstar_getkeycode(struct input_dev *dev, int scancode, int *keycode)
        return 0;
 }
 
-static int topstar_setkeycode(struct input_dev *dev, int scancode, int keycode)
+static int topstar_setkeycode(struct input_dev *dev,
+                               unsigned int scancode, unsigned int keycode)
 {
        struct tps_key_entry *key;
        int old_keycode;
 
-       if (keycode < 0 || keycode > KEY_MAX)
-               return -EINVAL;
-
        key = tps_get_key_by_scancode(scancode);
 
        if (!key)
index 405b969734d6cd8a2dff5221c454f55041c62956..789240d1b577b9c1fc43f861c4ee884ca5e22d16 100644 (file)
@@ -745,7 +745,7 @@ static struct backlight_ops toshiba_backlight_data = {
         .update_status  = set_lcd_status,
 };
 
-static struct key_entry *toshiba_acpi_get_entry_by_scancode(int code)
+static struct key_entry *toshiba_acpi_get_entry_by_scancode(unsigned int code)
 {
        struct key_entry *key;
 
@@ -756,7 +756,7 @@ static struct key_entry *toshiba_acpi_get_entry_by_scancode(int code)
        return NULL;
 }
 
-static struct key_entry *toshiba_acpi_get_entry_by_keycode(int code)
+static struct key_entry *toshiba_acpi_get_entry_by_keycode(unsigned int code)
 {
        struct key_entry *key;
 
@@ -767,8 +767,8 @@ static struct key_entry *toshiba_acpi_get_entry_by_keycode(int code)
        return NULL;
 }
 
-static int toshiba_acpi_getkeycode(struct input_dev *dev, int scancode,
-                                  int *keycode)
+static int toshiba_acpi_getkeycode(struct input_dev *dev,
+                                  unsigned int scancode, unsigned int *keycode)
 {
        struct key_entry *key = toshiba_acpi_get_entry_by_scancode(scancode);
 
@@ -780,14 +780,11 @@ static int toshiba_acpi_getkeycode(struct input_dev *dev, int scancode,
        return -EINVAL;
 }
 
-static int toshiba_acpi_setkeycode(struct input_dev *dev, int scancode,
-                                  int keycode)
+static int toshiba_acpi_setkeycode(struct input_dev *dev,
+                                  unsigned int scancode, unsigned int keycode)
 {
        struct key_entry *key;
-       int old_keycode;
-
-       if (keycode < 0 || keycode > KEY_MAX)
-               return -EINVAL;
+       unsigned int old_keycode;
 
        key = toshiba_acpi_get_entry_by_scancode(scancode);
        if (key && key->type == KE_KEY) {
index dc24effb6d0e71816d33d6501304aca44c879a86..7ed2251b33f17078a42369d73c1d48877b823c52 100644 (file)
@@ -58,10 +58,10 @@ struct input_absinfo {
 
 #define EVIOCGVERSION          _IOR('E', 0x01, int)                    /* get driver version */
 #define EVIOCGID               _IOR('E', 0x02, struct input_id)        /* get device ID */
-#define EVIOCGREP              _IOR('E', 0x03, int[2])                 /* get repeat settings */
-#define EVIOCSREP              _IOW('E', 0x03, int[2])                 /* set repeat settings */
-#define EVIOCGKEYCODE          _IOR('E', 0x04, int[2])                 /* get keycode */
-#define EVIOCSKEYCODE          _IOW('E', 0x04, int[2])                 /* set keycode */
+#define EVIOCGREP              _IOR('E', 0x03, unsigned int[2])        /* get repeat settings */
+#define EVIOCSREP              _IOW('E', 0x03, unsigned int[2])        /* set repeat settings */
+#define EVIOCGKEYCODE          _IOR('E', 0x04, unsigned int[2])        /* get keycode */
+#define EVIOCSKEYCODE          _IOW('E', 0x04, unsigned int[2])        /* set keycode */
 
 #define EVIOCGNAME(len)                _IOC(_IOC_READ, 'E', 0x06, len)         /* get device name */
 #define EVIOCGPHYS(len)                _IOC(_IOC_READ, 'E', 0x07, len)         /* get physical location */
@@ -1142,8 +1142,10 @@ struct input_dev {
        unsigned int keycodemax;
        unsigned int keycodesize;
        void *keycode;
-       int (*setkeycode)(struct input_dev *dev, int scancode, int keycode);
-       int (*getkeycode)(struct input_dev *dev, int scancode, int *keycode);
+       int (*setkeycode)(struct input_dev *dev,
+                         unsigned int scancode, unsigned int keycode);
+       int (*getkeycode)(struct input_dev *dev,
+                         unsigned int scancode, unsigned int *keycode);
 
        struct ff_device *ff;
 
@@ -1415,8 +1417,10 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min
        dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis);
 }
 
-int input_get_keycode(struct input_dev *dev, int scancode, int *keycode);
-int input_set_keycode(struct input_dev *dev, int scancode, int keycode);
+int input_get_keycode(struct input_dev *dev,
+                     unsigned int scancode, unsigned int *keycode);
+int input_set_keycode(struct input_dev *dev,
+                     unsigned int scancode, unsigned int keycode);
 
 extern struct class input_class;