hwmon: (it87) Add chassis intrusion detection support
[linux-2.6.git] / drivers / hid / hid-apple.c
index 6c52203..b85744f 100644 (file)
@@ -16,6 +16,8 @@
  * any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/device.h>
 #include <linux/hid.h>
 #include <linux/module.h>
@@ -167,7 +169,7 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
                struct hid_usage *usage, __s32 value)
 {
        struct apple_sc *asc = hid_get_drvdata(hid);
-       const struct apple_key_translation *trans;
+       const struct apple_key_translation *trans, *table;
 
        if (usage->code == KEY_FN) {
                asc->fn_on = !!value;
@@ -178,14 +180,15 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
        if (fnmode) {
                int do_translate;
 
-               if(hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
-                               hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) {
-                       trans = apple_find_translation(macbookair_fn_keys, usage->code);
-               } else if (hid->product < 0x21d || hid->product >= 0x300) {
-                       trans = apple_find_translation(powerbook_fn_keys, usage->code);
-               } else {
-                       trans = apple_find_translation(apple_fn_keys, usage->code);
-               }
+               if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
+                               hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
+                       table = macbookair_fn_keys;
+               else if (hid->product < 0x21d || hid->product >= 0x300)
+                       table = powerbook_fn_keys;
+               else
+                       table = apple_fn_keys;
+
+               trans = apple_find_translation (table, usage->code);
 
                if (trans) {
                        if (test_bit(usage->code, asc->pressed_fn))
@@ -279,8 +282,8 @@ static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 
        if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 &&
                        rdesc[53] == 0x65 && rdesc[59] == 0x65) {
-               dev_info(&hdev->dev, "fixing up MacBook JIS keyboard report "
-                               "descriptor\n");
+               hid_info(hdev,
+                        "fixing up MacBook JIS keyboard report descriptor\n");
                rdesc[53] = rdesc[59] = 0xe7;
        }
        return rdesc;
@@ -350,7 +353,7 @@ static int apple_probe(struct hid_device *hdev,
 
        asc = kzalloc(sizeof(*asc), GFP_KERNEL);
        if (asc == NULL) {
-               dev_err(&hdev->dev, "can't alloc apple descriptor\n");
+               hid_err(hdev, "can't alloc apple descriptor\n");
                return -ENOMEM;
        }
 
@@ -360,7 +363,7 @@ static int apple_probe(struct hid_device *hdev,
 
        ret = hid_parse(hdev);
        if (ret) {
-               dev_err(&hdev->dev, "parse failed\n");
+               hid_err(hdev, "parse failed\n");
                goto err_free;
        }
 
@@ -371,7 +374,7 @@ static int apple_probe(struct hid_device *hdev,
 
        ret = hid_hw_start(hdev, connect_mask);
        if (ret) {
-               dev_err(&hdev->dev, "hw start failed\n");
+               hid_err(hdev, "hw start failed\n");
                goto err_free;
        }
 
@@ -478,6 +481,12 @@ static const struct hid_device_id apple_devices[] = {
                .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS),
                .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
+       { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI),
+               .driver_data = APPLE_HAS_FN },
+       { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO),
+               .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+       { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS),
+               .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
                .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
@@ -511,7 +520,7 @@ static int __init apple_init(void)
 
        ret = hid_register_driver(&apple_driver);
        if (ret)
-               printk(KERN_ERR "can't register apple driver\n");
+               pr_err("can't register apple driver\n");
 
        return ret;
 }