Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
[safe/jmp/linux-2.6] / drivers / hid / hid-input.c
index 8430d62..7a0d2e4 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;
@@ -193,7 +193,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                break;
 
        case HID_UP_BUTTON:
-               code = ((usage->hid - 1) & 0xf);
+               code = ((usage->hid - 1) & HID_USAGE);
 
                switch (field->application) {
                case HID_GD_MOUSE:
@@ -405,6 +405,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                case 0x192: map_key_clear(KEY_CALC);            break;
                case 0x194: map_key_clear(KEY_FILE);            break;
                case 0x196: map_key_clear(KEY_WWW);             break;
+               case 0x199: map_key_clear(KEY_CHAT);            break;
                case 0x19c: map_key_clear(KEY_LOGOFF);          break;
                case 0x19e: map_key_clear(KEY_COFFEE);          break;
                case 0x1a6: map_key_clear(KEY_HELP);            break;