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/hid/hid

Pull HID fixes from Jiri Kosina:

- fixes for various drivers which assume that a HID device is on USB
transport, but that might not necessarily be the case, as the device
can be faked by uhid. (Greg, Benjamin Tissoires)

- fix for spurious wakeups on certain Lenovo notebooks (Thomas
Weißschuh)

- a few other device-specific quirks

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
HID: Ignore battery for Elan touchscreen on Asus UX550VE
HID: intel-ish-hid: ipc: only enable IRQ wakeup when requested
HID: google: add eel USB id
HID: add USB_HID dependancy to hid-prodikeys
HID: add USB_HID dependancy to hid-chicony
HID: bigbenff: prevent null pointer dereference
HID: sony: fix error path in probe
HID: add USB_HID dependancy on some USB HID drivers
HID: check for valid USB device for many HID drivers
HID: wacom: fix problems when device is not a valid USB device
HID: add hid_is_usb() function to make it simpler for USB detection
HID: quirks: Add quirk for the Microsoft Surface 3 type-cover

+146 -36
+5 -5
drivers/hid/Kconfig
··· 207 207 208 208 config HID_CHICONY 209 209 tristate "Chicony devices" 210 - depends on HID 210 + depends on USB_HID 211 211 default !EXPERT 212 212 help 213 213 Support for Chicony Tactical pad and special keys on Chicony keyboards. 214 214 215 215 config HID_CORSAIR 216 216 tristate "Corsair devices" 217 - depends on HID && USB && LEDS_CLASS 217 + depends on USB_HID && LEDS_CLASS 218 218 help 219 219 Support for Corsair devices that are not fully compliant with the 220 220 HID standard. ··· 245 245 246 246 config HID_PRODIKEYS 247 247 tristate "Prodikeys PC-MIDI Keyboard support" 248 - depends on HID && SND 248 + depends on USB_HID && SND 249 249 select SND_RAWMIDI 250 250 help 251 251 Support for Prodikeys PC-MIDI Keyboard device support. ··· 560 560 561 561 config HID_LOGITECH 562 562 tristate "Logitech devices" 563 - depends on HID 563 + depends on USB_HID 564 564 depends on LEDS_CLASS 565 565 default !EXPERT 566 566 help ··· 951 951 952 952 config HID_SAMSUNG 953 953 tristate "Samsung InfraRed remote control or keyboards" 954 - depends on HID 954 + depends on USB_HID 955 955 help 956 956 Support for Samsung InfraRed remote control or keyboards. 957 957
+2 -4
drivers/hid/hid-asus.c
··· 1028 1028 if (drvdata->quirks & QUIRK_IS_MULTITOUCH) 1029 1029 drvdata->tp = &asus_i2c_tp; 1030 1030 1031 - if ((drvdata->quirks & QUIRK_T100_KEYBOARD) && 1032 - hid_is_using_ll_driver(hdev, &usb_hid_driver)) { 1031 + if ((drvdata->quirks & QUIRK_T100_KEYBOARD) && hid_is_usb(hdev)) { 1033 1032 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 1034 1033 1035 1034 if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF) { ··· 1056 1057 drvdata->tp = &asus_t100chi_tp; 1057 1058 } 1058 1059 1059 - if ((drvdata->quirks & QUIRK_MEDION_E1239T) && 1060 - hid_is_using_ll_driver(hdev, &usb_hid_driver)) { 1060 + if ((drvdata->quirks & QUIRK_MEDION_E1239T) && hid_is_usb(hdev)) { 1061 1061 struct usb_host_interface *alt = 1062 1062 to_usb_interface(hdev->dev.parent)->altsetting; 1063 1063
+1 -1
drivers/hid/hid-bigbenff.c
··· 191 191 struct bigben_device, worker); 192 192 struct hid_field *report_field = bigben->report->field[0]; 193 193 194 - if (bigben->removed) 194 + if (bigben->removed || !report_field) 195 195 return; 196 196 197 197 if (bigben->work_led) {
+3
drivers/hid/hid-chicony.c
··· 114 114 { 115 115 int ret; 116 116 117 + if (!hid_is_usb(hdev)) 118 + return -EINVAL; 119 + 117 120 hdev->quirks |= HID_QUIRK_INPUT_PER_APP; 118 121 ret = hid_parse(hdev); 119 122 if (ret) {
+6 -1
drivers/hid/hid-corsair.c
··· 553 553 int ret; 554 554 unsigned long quirks = id->driver_data; 555 555 struct corsair_drvdata *drvdata; 556 - struct usb_interface *usbif = to_usb_interface(dev->dev.parent); 556 + struct usb_interface *usbif; 557 + 558 + if (!hid_is_usb(dev)) 559 + return -EINVAL; 560 + 561 + usbif = to_usb_interface(dev->dev.parent); 557 562 558 563 drvdata = devm_kzalloc(&dev->dev, sizeof(struct corsair_drvdata), 559 564 GFP_KERNEL);
+1 -1
drivers/hid/hid-elan.c
··· 50 50 51 51 static int is_not_elan_touchpad(struct hid_device *hdev) 52 52 { 53 - if (hdev->bus == BUS_USB) { 53 + if (hid_is_usb(hdev)) { 54 54 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 55 55 56 56 return (intf->altsetting->desc.bInterfaceNumber !=
+3
drivers/hid/hid-elo.c
··· 230 230 int ret; 231 231 struct usb_device *udev; 232 232 233 + if (!hid_is_usb(hdev)) 234 + return -EINVAL; 235 + 233 236 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 234 237 if (!priv) 235 238 return -ENOMEM;
+3
drivers/hid/hid-ft260.c
··· 915 915 struct ft260_get_chip_version_report version; 916 916 int ret; 917 917 918 + if (!hid_is_usb(hdev)) 919 + return -EINVAL; 920 + 918 921 dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL); 919 922 if (!dev) 920 923 return -ENOMEM;
+2
drivers/hid/hid-google-hammer.c
··· 586 586 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, 587 587 USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_DON) }, 588 588 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, 589 + USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_EEL) }, 590 + { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, 589 591 USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_HAMMER) }, 590 592 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, 591 593 USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_MAGNEMITE) },
+7 -2
drivers/hid/hid-holtek-kbd.c
··· 140 140 static int holtek_kbd_probe(struct hid_device *hdev, 141 141 const struct hid_device_id *id) 142 142 { 143 - struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 144 - int ret = hid_parse(hdev); 143 + struct usb_interface *intf; 144 + int ret; 145 145 146 + if (!hid_is_usb(hdev)) 147 + return -EINVAL; 148 + 149 + ret = hid_parse(hdev); 146 150 if (!ret) 147 151 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 148 152 153 + intf = to_usb_interface(hdev->dev.parent); 149 154 if (!ret && intf->cur_altsetting->desc.bInterfaceNumber == 1) { 150 155 struct hid_input *hidinput; 151 156 list_for_each_entry(hidinput, &hdev->inputs, list) {
+9
drivers/hid/hid-holtek-mouse.c
··· 62 62 return rdesc; 63 63 } 64 64 65 + static int holtek_mouse_probe(struct hid_device *hdev, 66 + const struct hid_device_id *id) 67 + { 68 + if (!hid_is_usb(hdev)) 69 + return -EINVAL; 70 + return 0; 71 + } 72 + 65 73 static const struct hid_device_id holtek_mouse_devices[] = { 66 74 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, 67 75 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, ··· 91 83 .name = "holtek_mouse", 92 84 .id_table = holtek_mouse_devices, 93 85 .report_fixup = holtek_mouse_report_fixup, 86 + .probe = holtek_mouse_probe, 94 87 }; 95 88 96 89 module_hid_driver(holtek_mouse_driver);
+3
drivers/hid/hid-ids.h
··· 399 399 #define USB_DEVICE_ID_HP_X2_10_COVER 0x0755 400 400 #define I2C_DEVICE_ID_HP_ENVY_X360_15 0x2d05 401 401 #define I2C_DEVICE_ID_HP_SPECTRE_X360_15 0x2817 402 + #define USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN 0x2544 402 403 #define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706 403 404 #define I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN 0x261A 404 405 ··· 502 501 #define USB_DEVICE_ID_GOOGLE_MAGNEMITE 0x503d 503 502 #define USB_DEVICE_ID_GOOGLE_MOONBALL 0x5044 504 503 #define USB_DEVICE_ID_GOOGLE_DON 0x5050 504 + #define USB_DEVICE_ID_GOOGLE_EEL 0x5057 505 505 506 506 #define USB_VENDOR_ID_GOTOP 0x08f2 507 507 #define USB_DEVICE_ID_SUPER_Q2 0x007f ··· 888 886 #define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7 889 887 #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9 890 888 #define USB_DEVICE_ID_MS_POWER_COVER 0x07da 889 + #define USB_DEVICE_ID_MS_SURFACE3_COVER 0x07de 891 890 #define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd 892 891 #define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb 893 892 #define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS 0x02e0
+2
drivers/hid/hid-input.c
··· 325 325 HID_BATTERY_QUIRK_IGNORE }, 326 326 { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN), 327 327 HID_BATTERY_QUIRK_IGNORE }, 328 + { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN), 329 + HID_BATTERY_QUIRK_IGNORE }, 328 330 { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15), 329 331 HID_BATTERY_QUIRK_IGNORE }, 330 332 { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_15),
+8 -2
drivers/hid/hid-lg.c
··· 749 749 750 750 static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) 751 751 { 752 - struct usb_interface *iface = to_usb_interface(hdev->dev.parent); 753 - __u8 iface_num = iface->cur_altsetting->desc.bInterfaceNumber; 752 + struct usb_interface *iface; 753 + __u8 iface_num; 754 754 unsigned int connect_mask = HID_CONNECT_DEFAULT; 755 755 struct lg_drv_data *drv_data; 756 756 int ret; 757 + 758 + if (!hid_is_usb(hdev)) 759 + return -EINVAL; 760 + 761 + iface = to_usb_interface(hdev->dev.parent); 762 + iface_num = iface->cur_altsetting->desc.bInterfaceNumber; 757 763 758 764 /* G29 only work with the 1st interface */ 759 765 if ((hdev->product == USB_DEVICE_ID_LOGITECH_G29_WHEEL) &&
+1 -1
drivers/hid/hid-logitech-dj.c
··· 1777 1777 case recvr_type_bluetooth: no_dj_interfaces = 2; break; 1778 1778 case recvr_type_dinovo: no_dj_interfaces = 2; break; 1779 1779 } 1780 - if (hid_is_using_ll_driver(hdev, &usb_hid_driver)) { 1780 + if (hid_is_usb(hdev)) { 1781 1781 intf = to_usb_interface(hdev->dev.parent); 1782 1782 if (intf && intf->altsetting->desc.bInterfaceNumber >= 1783 1783 no_dj_interfaces) {
+8 -2
drivers/hid/hid-prodikeys.c
··· 798 798 static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id) 799 799 { 800 800 int ret; 801 - struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 802 - unsigned short ifnum = intf->cur_altsetting->desc.bInterfaceNumber; 801 + struct usb_interface *intf; 802 + unsigned short ifnum; 803 803 unsigned long quirks = id->driver_data; 804 804 struct pk_device *pk; 805 805 struct pcmidi_snd *pm = NULL; 806 + 807 + if (!hid_is_usb(hdev)) 808 + return -EINVAL; 809 + 810 + intf = to_usb_interface(hdev->dev.parent); 811 + ifnum = intf->cur_altsetting->desc.bInterfaceNumber; 806 812 807 813 pk = kzalloc(sizeof(*pk), GFP_KERNEL); 808 814 if (pk == NULL) {
+1
drivers/hid/hid-quirks.c
··· 124 124 { HID_USB_DEVICE(USB_VENDOR_ID_MCS, USB_DEVICE_ID_MCS_GAMEPADBLOCK), HID_QUIRK_MULTI_INPUT }, 125 125 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PIXART_MOUSE), HID_QUIRK_ALWAYS_POLL }, 126 126 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER), HID_QUIRK_NO_INIT_REPORTS }, 127 + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE3_COVER), HID_QUIRK_NO_INIT_REPORTS }, 127 128 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE_PRO_2), HID_QUIRK_NO_INIT_REPORTS }, 128 129 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2), HID_QUIRK_NO_INIT_REPORTS }, 129 130 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2), HID_QUIRK_NO_INIT_REPORTS },
+3
drivers/hid/hid-roccat-arvo.c
··· 344 344 { 345 345 int retval; 346 346 347 + if (!hid_is_usb(hdev)) 348 + return -EINVAL; 349 + 347 350 retval = hid_parse(hdev); 348 351 if (retval) { 349 352 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-isku.c
··· 324 324 { 325 325 int retval; 326 326 327 + if (!hid_is_usb(hdev)) 328 + return -EINVAL; 329 + 327 330 retval = hid_parse(hdev); 328 331 if (retval) { 329 332 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-kone.c
··· 749 749 { 750 750 int retval; 751 751 752 + if (!hid_is_usb(hdev)) 753 + return -EINVAL; 754 + 752 755 retval = hid_parse(hdev); 753 756 if (retval) { 754 757 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-koneplus.c
··· 431 431 { 432 432 int retval; 433 433 434 + if (!hid_is_usb(hdev)) 435 + return -EINVAL; 436 + 434 437 retval = hid_parse(hdev); 435 438 if (retval) { 436 439 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-konepure.c
··· 133 133 { 134 134 int retval; 135 135 136 + if (!hid_is_usb(hdev)) 137 + return -EINVAL; 138 + 136 139 retval = hid_parse(hdev); 137 140 if (retval) { 138 141 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-kovaplus.c
··· 501 501 { 502 502 int retval; 503 503 504 + if (!hid_is_usb(hdev)) 505 + return -EINVAL; 506 + 504 507 retval = hid_parse(hdev); 505 508 if (retval) { 506 509 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-lua.c
··· 160 160 { 161 161 int retval; 162 162 163 + if (!hid_is_usb(hdev)) 164 + return -EINVAL; 165 + 163 166 retval = hid_parse(hdev); 164 167 if (retval) { 165 168 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-pyra.c
··· 449 449 { 450 450 int retval; 451 451 452 + if (!hid_is_usb(hdev)) 453 + return -EINVAL; 454 + 452 455 retval = hid_parse(hdev); 453 456 if (retval) { 454 457 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-ryos.c
··· 141 141 { 142 142 int retval; 143 143 144 + if (!hid_is_usb(hdev)) 145 + return -EINVAL; 146 + 144 147 retval = hid_parse(hdev); 145 148 if (retval) { 146 149 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-savu.c
··· 113 113 { 114 114 int retval; 115 115 116 + if (!hid_is_usb(hdev)) 117 + return -EINVAL; 118 + 116 119 retval = hid_parse(hdev); 117 120 if (retval) { 118 121 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-samsung.c
··· 152 152 int ret; 153 153 unsigned int cmask = HID_CONNECT_DEFAULT; 154 154 155 + if (!hid_is_usb(hdev)) 156 + return -EINVAL; 157 + 155 158 ret = hid_parse(hdev); 156 159 if (ret) { 157 160 hid_err(hdev, "parse failed\n");
+18 -6
drivers/hid/hid-sony.c
··· 3000 3000 sc->quirks = quirks; 3001 3001 hid_set_drvdata(hdev, sc); 3002 3002 sc->hdev = hdev; 3003 - usbdev = to_usb_device(sc->hdev->dev.parent->parent); 3004 3003 3005 3004 ret = hid_parse(hdev); 3006 3005 if (ret) { ··· 3037 3038 */ 3038 3039 if (!(hdev->claimed & HID_CLAIMED_INPUT)) { 3039 3040 hid_err(hdev, "failed to claim input\n"); 3040 - hid_hw_stop(hdev); 3041 - return -ENODEV; 3041 + ret = -ENODEV; 3042 + goto err; 3042 3043 } 3043 3044 3044 3045 if (sc->quirks & (GHL_GUITAR_PS3WIIU | GHL_GUITAR_PS4)) { 3046 + if (!hid_is_usb(hdev)) { 3047 + ret = -EINVAL; 3048 + goto err; 3049 + } 3050 + 3051 + usbdev = to_usb_device(sc->hdev->dev.parent->parent); 3052 + 3045 3053 sc->ghl_urb = usb_alloc_urb(0, GFP_ATOMIC); 3046 - if (!sc->ghl_urb) 3047 - return -ENOMEM; 3054 + if (!sc->ghl_urb) { 3055 + ret = -ENOMEM; 3056 + goto err; 3057 + } 3048 3058 3049 3059 if (sc->quirks & GHL_GUITAR_PS3WIIU) 3050 3060 ret = ghl_init_urb(sc, usbdev, ghl_ps3wiiu_magic_data, ··· 3063 3055 ARRAY_SIZE(ghl_ps4_magic_data)); 3064 3056 if (ret) { 3065 3057 hid_err(hdev, "error preparing URB\n"); 3066 - return ret; 3058 + goto err; 3067 3059 } 3068 3060 3069 3061 timer_setup(&sc->ghl_poke_timer, ghl_magic_poke, 0); ··· 3071 3063 jiffies + GHL_GUITAR_POKE_INTERVAL*HZ); 3072 3064 } 3073 3065 3066 + return ret; 3067 + 3068 + err: 3069 + hid_hw_stop(hdev); 3074 3070 return ret; 3075 3071 } 3076 3072
+3
drivers/hid/hid-thrustmaster.c
··· 274 274 int ret = 0; 275 275 struct tm_wheel *tm_wheel = NULL; 276 276 277 + if (!hid_is_usb(hdev)) 278 + return -EINVAL; 279 + 277 280 ret = hid_parse(hdev); 278 281 if (ret) { 279 282 hid_err(hdev, "parse failed with error %d\n", ret);
+1 -1
drivers/hid/hid-u2fzero.c
··· 311 311 unsigned int minor; 312 312 int ret; 313 313 314 - if (!hid_is_using_ll_driver(hdev, &usb_hid_driver)) 314 + if (!hid_is_usb(hdev)) 315 315 return -EINVAL; 316 316 317 317 dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL);
+3
drivers/hid/hid-uclogic-core.c
··· 164 164 struct uclogic_drvdata *drvdata = NULL; 165 165 bool params_initialized = false; 166 166 167 + if (!hid_is_usb(hdev)) 168 + return -EINVAL; 169 + 167 170 /* 168 171 * libinput requires the pad interface to be on a different node 169 172 * than the pen, so use QUIRK_MULTI_INPUT for all tablets.
+1 -2
drivers/hid/hid-uclogic-params.c
··· 843 843 struct uclogic_params p = {0, }; 844 844 845 845 /* Check arguments */ 846 - if (params == NULL || hdev == NULL || 847 - !hid_is_using_ll_driver(hdev, &usb_hid_driver)) { 846 + if (params == NULL || hdev == NULL || !hid_is_usb(hdev)) { 848 847 rc = -EINVAL; 849 848 goto cleanup; 850 849 }
+4 -2
drivers/hid/intel-ish-hid/ipc/pci-ish.c
··· 266 266 267 267 if (ish_should_leave_d0i3(pdev) && !dev->suspend_flag 268 268 && IPC_IS_ISH_ILUP(fwsts)) { 269 - disable_irq_wake(pdev->irq); 269 + if (device_may_wakeup(&pdev->dev)) 270 + disable_irq_wake(pdev->irq); 270 271 271 272 ish_set_host_ready(dev); 272 273 ··· 338 337 */ 339 338 pci_save_state(pdev); 340 339 341 - enable_irq_wake(pdev->irq); 340 + if (device_may_wakeup(&pdev->dev)) 341 + enable_irq_wake(pdev->irq); 342 342 } 343 343 } else { 344 344 /*
+13 -6
drivers/hid/wacom_sys.c
··· 726 726 * Skip the query for this type and modify defaults based on 727 727 * interface number. 728 728 */ 729 - if (features->type == WIRELESS) { 729 + if (features->type == WIRELESS && intf) { 730 730 if (intf->cur_altsetting->desc.bInterfaceNumber == 0) 731 731 features->device_type = WACOM_DEVICETYPE_WL_MONITOR; 732 732 else ··· 2214 2214 if ((features->type == HID_GENERIC) && !strcmp("Wacom HID", features->name)) { 2215 2215 char *product_name = wacom->hdev->name; 2216 2216 2217 - if (hid_is_using_ll_driver(wacom->hdev, &usb_hid_driver)) { 2217 + if (hid_is_usb(wacom->hdev)) { 2218 2218 struct usb_interface *intf = to_usb_interface(wacom->hdev->dev.parent); 2219 2219 struct usb_device *dev = interface_to_usbdev(intf); 2220 2220 product_name = dev->product; ··· 2450 2450 */ 2451 2451 2452 2452 wacom_destroy_battery(wacom); 2453 + 2454 + if (!usbdev) 2455 + return; 2453 2456 2454 2457 /* Stylus interface */ 2455 2458 hdev1 = usb_get_intfdata(usbdev->config->interface[1]); ··· 2733 2730 static int wacom_probe(struct hid_device *hdev, 2734 2731 const struct hid_device_id *id) 2735 2732 { 2736 - struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 2737 - struct usb_device *dev = interface_to_usbdev(intf); 2738 2733 struct wacom *wacom; 2739 2734 struct wacom_wac *wacom_wac; 2740 2735 struct wacom_features *features; ··· 2767 2766 wacom_wac->hid_data.inputmode = -1; 2768 2767 wacom_wac->mode_report = -1; 2769 2768 2770 - wacom->usbdev = dev; 2771 - wacom->intf = intf; 2769 + if (hid_is_usb(hdev)) { 2770 + struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 2771 + struct usb_device *dev = interface_to_usbdev(intf); 2772 + 2773 + wacom->usbdev = dev; 2774 + wacom->intf = intf; 2775 + } 2776 + 2772 2777 mutex_init(&wacom->lock); 2773 2778 INIT_DELAYED_WORK(&wacom->init_work, wacom_init_work); 2774 2779 INIT_WORK(&wacom->wireless_work, wacom_wireless_work);
+5
include/linux/hid.h
··· 840 840 return hdev->ll_driver == driver; 841 841 } 842 842 843 + static inline bool hid_is_usb(struct hid_device *hdev) 844 + { 845 + return hid_is_using_ll_driver(hdev, &usb_hid_driver); 846 + } 847 + 843 848 #define PM_HINT_FULLON 1<<5 844 849 #define PM_HINT_NORMAL 1<<1 845 850