Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
Revert "HID: multitouch: decide if hid-multitouch needs to handle mt devices"
HID: drivers/hid/hid-roccat.c: eliminate a null pointer dereference
HID: hid-apple: add device ID of another wireless aluminium
HID: Add device IDs for Macbook Pro 8 keyboards

+33 -52
+9
drivers/hid/hid-apple.c
··· 458 458 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO), 459 459 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 460 460 APPLE_ISO_KEYBOARD }, 461 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO), 462 + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | 463 + APPLE_ISO_KEYBOARD }, 461 464 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), 462 465 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, 463 466 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), ··· 510 507 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO), 511 508 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, 512 509 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS), 510 + .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, 511 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI), 512 + .driver_data = APPLE_HAS_FN }, 513 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO), 514 + .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, 515 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS), 513 516 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, 514 517 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), 515 518 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
+7
drivers/hid/hid-core.c
··· 1362 1362 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, 1363 1363 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, 1364 1364 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, 1365 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) }, 1366 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) }, 1367 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) }, 1365 1368 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI) }, 1366 1369 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO) }, 1367 1370 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS) }, ··· 1377 1374 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, 1378 1375 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, 1379 1376 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, 1377 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) }, 1380 1378 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 1381 1379 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1382 1380 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) }, ··· 1946 1942 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, 1947 1943 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, 1948 1944 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, 1945 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) }, 1946 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) }, 1947 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) }, 1949 1948 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, 1950 1949 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, 1951 1950 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) },
+4
drivers/hid/hid-ids.h
··· 112 112 #define USB_DEVICE_ID_APPLE_ALU_REVB_ANSI 0x024f 113 113 #define USB_DEVICE_ID_APPLE_ALU_REVB_ISO 0x0250 114 114 #define USB_DEVICE_ID_APPLE_ALU_REVB_JIS 0x0251 115 + #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252 116 + #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253 117 + #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254 115 118 #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249 116 119 #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a 117 120 #define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b ··· 124 121 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239 125 122 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a 126 123 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b 124 + #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO 0x0256 127 125 #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a 128 126 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b 129 127 #define USB_DEVICE_ID_APPLE_ATV_IRCONTROL 0x8241
+4 -43
drivers/hid/hid-multitouch.c
··· 291 291 td->last_slot_field = usage->hid; 292 292 td->last_field_index = field->index; 293 293 td->last_mt_collection = usage->collection_index; 294 - hdev->quirks &= ~HID_QUIRK_MULTITOUCH; 295 294 return 1; 296 295 case HID_DG_WIDTH: 297 296 hid_map_usage(hi, usage, bit, max, ··· 529 530 } 530 531 } 531 532 532 - /* a list of devices for which there is a specialized multitouch driver */ 533 - static const struct hid_device_id mt_have_special_driver[] = { 534 - { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, 0x0001) }, 535 - { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, 0x0006) }, 536 - { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, 537 - USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) }, 538 - { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, 539 - USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) }, 540 - { } 541 - }; 542 - 543 - static bool mt_match_one_id(struct hid_device *hdev, 544 - const struct hid_device_id *id) 545 - { 546 - return id->bus == hdev->bus && 547 - (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) && 548 - (id->product == HID_ANY_ID || id->product == hdev->product); 549 - } 550 - 551 - static const struct hid_device_id *mt_match_id(struct hid_device *hdev, 552 - const struct hid_device_id *id) 553 - { 554 - for (; id->bus; id++) 555 - if (mt_match_one_id(hdev, id)) 556 - return id; 557 - 558 - return NULL; 559 - } 560 - 561 533 static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) 562 534 { 563 535 int ret, i; 564 536 struct mt_device *td; 565 537 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */ 566 - 567 - if (mt_match_id(hdev, mt_have_special_driver)) 568 - return -ENODEV; 569 538 570 539 for (i = 0; mt_classes[i].name ; i++) { 571 540 if (id->driver_data == mt_classes[i].name) { ··· 542 575 } 543 576 } 544 577 578 + /* This allows the driver to correctly support devices 579 + * that emit events over several HID messages. 580 + */ 581 + hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; 545 582 546 583 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL); 547 584 if (!td) { ··· 561 590 if (ret != 0) 562 591 goto fail; 563 592 564 - hdev->quirks |= HID_QUIRK_MULTITOUCH; 565 593 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 566 594 if (ret) 567 595 goto fail; 568 - 569 - /* This allows the driver to correctly support devices 570 - * that emit events over several HID messages. 571 - */ 572 - hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; 573 596 574 597 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot), 575 598 GFP_KERNEL); ··· 757 792 { .driver_data = MT_CLS_DEFAULT, 758 793 HID_USB_DEVICE(USB_VENDOR_ID_XAT, 759 794 USB_DEVICE_ID_XAT_CSR) }, 760 - 761 - /* Rest of the world */ 762 - { .driver_data = MT_CLS_DEFAULT, 763 - HID_USB_DEVICE(HID_ANY_ID, HID_ANY_ID) }, 764 795 765 796 { } 766 797 };
+9 -9
drivers/hid/hid-roccat.c
··· 162 162 163 163 device = devices[minor]; 164 164 165 - mutex_lock(&device->readers_lock); 166 - 167 165 if (!device) { 168 166 pr_emerg("roccat device with minor %d doesn't exist\n", minor); 169 167 error = -ENODEV; 170 - goto exit_err; 168 + goto exit_err_devices; 171 169 } 170 + 171 + mutex_lock(&device->readers_lock); 172 172 173 173 if (!device->open++) { 174 174 /* power on device on adding first reader */ 175 175 error = hid_hw_power(device->hid, PM_HINT_FULLON); 176 176 if (error < 0) { 177 177 --device->open; 178 - goto exit_err; 178 + goto exit_err_readers; 179 179 } 180 180 181 181 error = hid_hw_open(device->hid); 182 182 if (error < 0) { 183 183 hid_hw_power(device->hid, PM_HINT_NORMAL); 184 184 --device->open; 185 - goto exit_err; 185 + goto exit_err_readers; 186 186 } 187 187 } 188 188 ··· 193 193 list_add_tail(&reader->node, &device->readers); 194 194 file->private_data = reader; 195 195 196 - exit_unlock: 196 + exit_err_readers: 197 197 mutex_unlock(&device->readers_lock); 198 + exit_err_devices: 198 199 mutex_unlock(&devices_lock); 200 + if (error) 201 + kfree(reader); 199 202 return error; 200 - exit_err: 201 - kfree(reader); 202 - goto exit_unlock; 203 203 } 204 204 205 205 static int roccat_release(struct inode *inode, struct file *file)