Commit 03090cc7 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 2990c89d 14902f89
...@@ -207,14 +207,14 @@ config HID_CHERRY ...@@ -207,14 +207,14 @@ config HID_CHERRY
config HID_CHICONY config HID_CHICONY
tristate "Chicony devices" tristate "Chicony devices"
depends on HID depends on USB_HID
default !EXPERT default !EXPERT
help help
Support for Chicony Tactical pad and special keys on Chicony keyboards. Support for Chicony Tactical pad and special keys on Chicony keyboards.
config HID_CORSAIR config HID_CORSAIR
tristate "Corsair devices" tristate "Corsair devices"
depends on HID && USB && LEDS_CLASS depends on USB_HID && LEDS_CLASS
help help
Support for Corsair devices that are not fully compliant with the Support for Corsair devices that are not fully compliant with the
HID standard. HID standard.
...@@ -245,7 +245,7 @@ config HID_MACALLY ...@@ -245,7 +245,7 @@ config HID_MACALLY
config HID_PRODIKEYS config HID_PRODIKEYS
tristate "Prodikeys PC-MIDI Keyboard support" tristate "Prodikeys PC-MIDI Keyboard support"
depends on HID && SND depends on USB_HID && SND
select SND_RAWMIDI select SND_RAWMIDI
help help
Support for Prodikeys PC-MIDI Keyboard device support. Support for Prodikeys PC-MIDI Keyboard device support.
...@@ -560,7 +560,7 @@ config HID_LENOVO ...@@ -560,7 +560,7 @@ config HID_LENOVO
config HID_LOGITECH config HID_LOGITECH
tristate "Logitech devices" tristate "Logitech devices"
depends on HID depends on USB_HID
depends on LEDS_CLASS depends on LEDS_CLASS
default !EXPERT default !EXPERT
help help
...@@ -951,7 +951,7 @@ config HID_SAITEK ...@@ -951,7 +951,7 @@ config HID_SAITEK
config HID_SAMSUNG config HID_SAMSUNG
tristate "Samsung InfraRed remote control or keyboards" tristate "Samsung InfraRed remote control or keyboards"
depends on HID depends on USB_HID
help help
Support for Samsung InfraRed remote control or keyboards. Support for Samsung InfraRed remote control or keyboards.
......
...@@ -1028,8 +1028,7 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -1028,8 +1028,7 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
if (drvdata->quirks & QUIRK_IS_MULTITOUCH) if (drvdata->quirks & QUIRK_IS_MULTITOUCH)
drvdata->tp = &asus_i2c_tp; drvdata->tp = &asus_i2c_tp;
if ((drvdata->quirks & QUIRK_T100_KEYBOARD) && if ((drvdata->quirks & QUIRK_T100_KEYBOARD) && hid_is_usb(hdev)) {
hid_is_using_ll_driver(hdev, &usb_hid_driver)) {
struct usb_interface *intf = to_usb_interface(hdev->dev.parent); struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF) { if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF) {
...@@ -1057,8 +1056,7 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -1057,8 +1056,7 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
drvdata->tp = &asus_t100chi_tp; drvdata->tp = &asus_t100chi_tp;
} }
if ((drvdata->quirks & QUIRK_MEDION_E1239T) && if ((drvdata->quirks & QUIRK_MEDION_E1239T) && hid_is_usb(hdev)) {
hid_is_using_ll_driver(hdev, &usb_hid_driver)) {
struct usb_host_interface *alt = struct usb_host_interface *alt =
to_usb_interface(hdev->dev.parent)->altsetting; to_usb_interface(hdev->dev.parent)->altsetting;
......
...@@ -191,7 +191,7 @@ static void bigben_worker(struct work_struct *work) ...@@ -191,7 +191,7 @@ static void bigben_worker(struct work_struct *work)
struct bigben_device, worker); struct bigben_device, worker);
struct hid_field *report_field = bigben->report->field[0]; struct hid_field *report_field = bigben->report->field[0];
if (bigben->removed) if (bigben->removed || !report_field)
return; return;
if (bigben->work_led) { if (bigben->work_led) {
......
...@@ -114,6 +114,9 @@ static int ch_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -114,6 +114,9 @@ static int ch_probe(struct hid_device *hdev, const struct hid_device_id *id)
{ {
int ret; int ret;
if (!hid_is_usb(hdev))
return -EINVAL;
hdev->quirks |= HID_QUIRK_INPUT_PER_APP; hdev->quirks |= HID_QUIRK_INPUT_PER_APP;
ret = hid_parse(hdev); ret = hid_parse(hdev);
if (ret) { if (ret) {
......
...@@ -553,7 +553,12 @@ static int corsair_probe(struct hid_device *dev, const struct hid_device_id *id) ...@@ -553,7 +553,12 @@ static int corsair_probe(struct hid_device *dev, const struct hid_device_id *id)
int ret; int ret;
unsigned long quirks = id->driver_data; unsigned long quirks = id->driver_data;
struct corsair_drvdata *drvdata; struct corsair_drvdata *drvdata;
struct usb_interface *usbif = to_usb_interface(dev->dev.parent); struct usb_interface *usbif;
if (!hid_is_usb(dev))
return -EINVAL;
usbif = to_usb_interface(dev->dev.parent);
drvdata = devm_kzalloc(&dev->dev, sizeof(struct corsair_drvdata), drvdata = devm_kzalloc(&dev->dev, sizeof(struct corsair_drvdata),
GFP_KERNEL); GFP_KERNEL);
......
...@@ -50,7 +50,7 @@ struct elan_drvdata { ...@@ -50,7 +50,7 @@ struct elan_drvdata {
static int is_not_elan_touchpad(struct hid_device *hdev) static int is_not_elan_touchpad(struct hid_device *hdev)
{ {
if (hdev->bus == BUS_USB) { if (hid_is_usb(hdev)) {
struct usb_interface *intf = to_usb_interface(hdev->dev.parent); struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
return (intf->altsetting->desc.bInterfaceNumber != return (intf->altsetting->desc.bInterfaceNumber !=
......
...@@ -230,6 +230,9 @@ static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -230,6 +230,9 @@ static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id)
int ret; int ret;
struct usb_device *udev; struct usb_device *udev;
if (!hid_is_usb(hdev))
return -EINVAL;
priv = kzalloc(sizeof(*priv), GFP_KERNEL); priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
......
...@@ -915,6 +915,9 @@ static int ft260_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -915,6 +915,9 @@ static int ft260_probe(struct hid_device *hdev, const struct hid_device_id *id)
struct ft260_get_chip_version_report version; struct ft260_get_chip_version_report version;
int ret; int ret;
if (!hid_is_usb(hdev))
return -EINVAL;
dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL); dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL);
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
......
...@@ -585,6 +585,8 @@ static void hammer_remove(struct hid_device *hdev) ...@@ -585,6 +585,8 @@ static void hammer_remove(struct hid_device *hdev)
static const struct hid_device_id hammer_devices[] = { static const struct hid_device_id hammer_devices[] = {
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_DON) }, USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_DON) },
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_EEL) },
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_HAMMER) }, USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_HAMMER) },
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
......
...@@ -140,12 +140,17 @@ static int holtek_kbd_input_event(struct input_dev *dev, unsigned int type, ...@@ -140,12 +140,17 @@ static int holtek_kbd_input_event(struct input_dev *dev, unsigned int type,
static int holtek_kbd_probe(struct hid_device *hdev, static int holtek_kbd_probe(struct hid_device *hdev,
const struct hid_device_id *id) const struct hid_device_id *id)
{ {
struct usb_interface *intf = to_usb_interface(hdev->dev.parent); struct usb_interface *intf;
int ret = hid_parse(hdev); int ret;
if (!hid_is_usb(hdev))
return -EINVAL;
ret = hid_parse(hdev);
if (!ret) if (!ret)
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
intf = to_usb_interface(hdev->dev.parent);
if (!ret && intf->cur_altsetting->desc.bInterfaceNumber == 1) { if (!ret && intf->cur_altsetting->desc.bInterfaceNumber == 1) {
struct hid_input *hidinput; struct hid_input *hidinput;
list_for_each_entry(hidinput, &hdev->inputs, list) { list_for_each_entry(hidinput, &hdev->inputs, list) {
......
...@@ -62,6 +62,14 @@ static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, ...@@ -62,6 +62,14 @@ static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
return rdesc; return rdesc;
} }
static int holtek_mouse_probe(struct hid_device *hdev,
const struct hid_device_id *id)
{
if (!hid_is_usb(hdev))
return -EINVAL;
return 0;
}
static const struct hid_device_id holtek_mouse_devices[] = { static const struct hid_device_id holtek_mouse_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) },
...@@ -83,6 +91,7 @@ static struct hid_driver holtek_mouse_driver = { ...@@ -83,6 +91,7 @@ static struct hid_driver holtek_mouse_driver = {
.name = "holtek_mouse", .name = "holtek_mouse",
.id_table = holtek_mouse_devices, .id_table = holtek_mouse_devices,
.report_fixup = holtek_mouse_report_fixup, .report_fixup = holtek_mouse_report_fixup,
.probe = holtek_mouse_probe,
}; };
module_hid_driver(holtek_mouse_driver); module_hid_driver(holtek_mouse_driver);
......
...@@ -399,6 +399,7 @@ ...@@ -399,6 +399,7 @@
#define USB_DEVICE_ID_HP_X2_10_COVER 0x0755 #define USB_DEVICE_ID_HP_X2_10_COVER 0x0755
#define I2C_DEVICE_ID_HP_ENVY_X360_15 0x2d05 #define I2C_DEVICE_ID_HP_ENVY_X360_15 0x2d05
#define I2C_DEVICE_ID_HP_SPECTRE_X360_15 0x2817 #define I2C_DEVICE_ID_HP_SPECTRE_X360_15 0x2817
#define USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN 0x2544
#define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706 #define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706
#define I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN 0x261A #define I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN 0x261A
...@@ -501,6 +502,7 @@ ...@@ -501,6 +502,7 @@
#define USB_DEVICE_ID_GOOGLE_MAGNEMITE 0x503d #define USB_DEVICE_ID_GOOGLE_MAGNEMITE 0x503d
#define USB_DEVICE_ID_GOOGLE_MOONBALL 0x5044 #define USB_DEVICE_ID_GOOGLE_MOONBALL 0x5044
#define USB_DEVICE_ID_GOOGLE_DON 0x5050 #define USB_DEVICE_ID_GOOGLE_DON 0x5050
#define USB_DEVICE_ID_GOOGLE_EEL 0x5057
#define USB_VENDOR_ID_GOTOP 0x08f2 #define USB_VENDOR_ID_GOTOP 0x08f2
#define USB_DEVICE_ID_SUPER_Q2 0x007f #define USB_DEVICE_ID_SUPER_Q2 0x007f
...@@ -886,6 +888,7 @@ ...@@ -886,6 +888,7 @@
#define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7 #define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7
#define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9 #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9
#define USB_DEVICE_ID_MS_POWER_COVER 0x07da #define USB_DEVICE_ID_MS_POWER_COVER 0x07da
#define USB_DEVICE_ID_MS_SURFACE3_COVER 0x07de
#define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd #define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd
#define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb #define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb
#define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS 0x02e0 #define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS 0x02e0
......
...@@ -325,6 +325,8 @@ static const struct hid_device_id hid_battery_quirks[] = { ...@@ -325,6 +325,8 @@ static const struct hid_device_id hid_battery_quirks[] = {
HID_BATTERY_QUIRK_IGNORE }, HID_BATTERY_QUIRK_IGNORE },
{ HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN), { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN),
HID_BATTERY_QUIRK_IGNORE }, HID_BATTERY_QUIRK_IGNORE },
{ HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN),
HID_BATTERY_QUIRK_IGNORE },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15), { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15),
HID_BATTERY_QUIRK_IGNORE }, HID_BATTERY_QUIRK_IGNORE },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_15), { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_15),
......
...@@ -749,12 +749,18 @@ static int lg_raw_event(struct hid_device *hdev, struct hid_report *report, ...@@ -749,12 +749,18 @@ static int lg_raw_event(struct hid_device *hdev, struct hid_report *report,
static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
{ {
struct usb_interface *iface = to_usb_interface(hdev->dev.parent); struct usb_interface *iface;
__u8 iface_num = iface->cur_altsetting->desc.bInterfaceNumber; __u8 iface_num;
unsigned int connect_mask = HID_CONNECT_DEFAULT; unsigned int connect_mask = HID_CONNECT_DEFAULT;
struct lg_drv_data *drv_data; struct lg_drv_data *drv_data;
int ret; int ret;
if (!hid_is_usb(hdev))
return -EINVAL;
iface = to_usb_interface(hdev->dev.parent);
iface_num = iface->cur_altsetting->desc.bInterfaceNumber;
/* G29 only work with the 1st interface */ /* G29 only work with the 1st interface */
if ((hdev->product == USB_DEVICE_ID_LOGITECH_G29_WHEEL) && if ((hdev->product == USB_DEVICE_ID_LOGITECH_G29_WHEEL) &&
(iface_num != 0)) { (iface_num != 0)) {
......
...@@ -1777,7 +1777,7 @@ static int logi_dj_probe(struct hid_device *hdev, ...@@ -1777,7 +1777,7 @@ static int logi_dj_probe(struct hid_device *hdev,
case recvr_type_bluetooth: no_dj_interfaces = 2; break; case recvr_type_bluetooth: no_dj_interfaces = 2; break;
case recvr_type_dinovo: no_dj_interfaces = 2; break; case recvr_type_dinovo: no_dj_interfaces = 2; break;
} }
if (hid_is_using_ll_driver(hdev, &usb_hid_driver)) { if (hid_is_usb(hdev)) {
intf = to_usb_interface(hdev->dev.parent); intf = to_usb_interface(hdev->dev.parent);
if (intf && intf->altsetting->desc.bInterfaceNumber >= if (intf && intf->altsetting->desc.bInterfaceNumber >=
no_dj_interfaces) { no_dj_interfaces) {
......
...@@ -798,12 +798,18 @@ static int pk_raw_event(struct hid_device *hdev, struct hid_report *report, ...@@ -798,12 +798,18 @@ static int pk_raw_event(struct hid_device *hdev, struct hid_report *report,
static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id) static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id)
{ {
int ret; int ret;
struct usb_interface *intf = to_usb_interface(hdev->dev.parent); struct usb_interface *intf;
unsigned short ifnum = intf->cur_altsetting->desc.bInterfaceNumber; unsigned short ifnum;
unsigned long quirks = id->driver_data; unsigned long quirks = id->driver_data;
struct pk_device *pk; struct pk_device *pk;
struct pcmidi_snd *pm = NULL; struct pcmidi_snd *pm = NULL;
if (!hid_is_usb(hdev))
return -EINVAL;
intf = to_usb_interface(hdev->dev.parent);
ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
pk = kzalloc(sizeof(*pk), GFP_KERNEL); pk = kzalloc(sizeof(*pk), GFP_KERNEL);
if (pk == NULL) { if (pk == NULL) {
hid_err(hdev, "can't alloc descriptor\n"); hid_err(hdev, "can't alloc descriptor\n");
......
...@@ -124,6 +124,7 @@ static const struct hid_device_id hid_quirks[] = { ...@@ -124,6 +124,7 @@ static const struct hid_device_id hid_quirks[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_MCS, USB_DEVICE_ID_MCS_GAMEPADBLOCK), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_MCS, USB_DEVICE_ID_MCS_GAMEPADBLOCK), HID_QUIRK_MULTI_INPUT },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PIXART_MOUSE), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PIXART_MOUSE), HID_QUIRK_ALWAYS_POLL },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER), HID_QUIRK_NO_INIT_REPORTS }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER), HID_QUIRK_NO_INIT_REPORTS },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE3_COVER), HID_QUIRK_NO_INIT_REPORTS },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE_PRO_2), HID_QUIRK_NO_INIT_REPORTS }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE_PRO_2), HID_QUIRK_NO_INIT_REPORTS },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2), HID_QUIRK_NO_INIT_REPORTS }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2), HID_QUIRK_NO_INIT_REPORTS },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2), HID_QUIRK_NO_INIT_REPORTS }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2), HID_QUIRK_NO_INIT_REPORTS },
......
...@@ -344,6 +344,9 @@ static int arvo_probe(struct hid_device *hdev, ...@@ -344,6 +344,9 @@ static int arvo_probe(struct hid_device *hdev,
{ {
int retval; int retval;
if (!hid_is_usb(hdev))
return -EINVAL;
retval = hid_parse(hdev); retval = hid_parse(hdev);
if (retval) { if (retval) {
hid_err(hdev, "parse failed\n"); hid_err(hdev, "parse failed\n");
......
...@@ -324,6 +324,9 @@ static int isku_probe(struct hid_device *hdev, ...@@ -324,6 +324,9 @@ static int isku_probe(struct hid_device *hdev,
{ {
int retval; int retval;
if (!hid_is_usb(hdev))
return -EINVAL;
retval = hid_parse(hdev); retval = hid_parse(hdev);
if (retval) { if (retval) {
hid_err(hdev, "parse failed\n"); hid_err(hdev, "parse failed\n");
......
...@@ -749,6 +749,9 @@ static int kone_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -749,6 +749,9 @@ static int kone_probe(struct hid_device *hdev, const struct hid_device_id *id)
{ {
int retval; int retval;
if (!hid_is_usb(hdev))
return -EINVAL;
retval = hid_parse(hdev); retval = hid_parse(hdev);
if (retval) { if (retval) {
hid_err(hdev, "parse failed\n"); hid_err(hdev, "parse failed\n");
......
...@@ -431,6 +431,9 @@ static int koneplus_probe(struct hid_device *hdev, ...@@ -431,6 +431,9 @@ static int koneplus_probe(struct hid_device *hdev,
{ {
int retval; int retval;
if (!hid_is_usb(hdev))
return -EINVAL;
retval = hid_parse(hdev); retval = hid_parse(hdev);
if (retval) { if (retval) {
hid_err(hdev, "parse failed\n"); hid_err(hdev, "parse failed\n");
......
...@@ -133,6 +133,9 @@ static int konepure_probe(struct hid_device *hdev, ...@@ -133,6 +133,9 @@ static int konepure_probe(struct hid_device *hdev,
{ {
int retval; int retval;
if (!hid_is_usb(hdev))
return -EINVAL;
retval = hid_parse(hdev); retval = hid_parse(hdev);
if (retval) { if (retval) {
hid_err(hdev, "parse failed\n"); hid_err(hdev, "parse failed\n");
......
...@@ -501,6 +501,9 @@ static int kovaplus_probe(struct hid_device *hdev, ...@@ -501,6 +501,9 @@ static int kovaplus_probe(struct hid_device *hdev,
{ {
int retval; int retval;
if (!hid_is_usb(hdev))
return -EINVAL;
retval = hid_parse(hdev); retval = hid_parse(hdev);
if (retval) { if (retval) {
hid_err(hdev, "parse failed\n"); hid_err(hdev, "parse failed\n");
......
...@@ -160,6 +160,9 @@ static int lua_probe(struct hid_device *hdev, ...@@ -160,6 +160,9 @@ static int lua_probe(struct hid_device *hdev,
{ {
int retval; int retval;
if (!hid_is_usb(hdev))
return -EINVAL;
retval = hid_parse(hdev); retval = hid_parse(hdev);
if (retval) { if (retval) {
hid_err(hdev, "parse failed\n"); hid_err(hdev, "parse failed\n");
......
...@@ -449,6 +449,9 @@ static int pyra_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -449,6 +449,9 @@ static int pyra_probe(struct hid_device *hdev, const struct hid_device_id *id)
{ {
int retval; int retval;
if (!hid_is_usb(hdev))
return -EINVAL;
retval = hid_parse(hdev); retval = hid_parse(hdev);
if (retval) { if (retval) {
hid_err(hdev, "parse failed\n"); hid_err(hdev, "parse failed\n");
......
...@@ -141,6 +141,9 @@ static int ryos_probe(struct hid_device *hdev, ...@@ -141,6 +141,9 @@ static int ryos_probe(struct hid_device *hdev,
{ {
int retval; int retval;
if (!hid_is_usb(hdev))
return -EINVAL;
retval = hid_parse(hdev); retval = hid_parse(hdev);
if (retval) { if (retval) {
hid_err(hdev, "parse failed\n"); hid_err(hdev, "parse failed\n");
......
...@@ -113,6 +113,9 @@ static int savu_probe(struct hid_device *hdev, ...@@ -113,6 +113,9 @@ static int savu_probe(struct hid_device *hdev,
{ {
int retval; int retval;
if (!hid_is_usb(hdev))
return -EINVAL;
retval = hid_parse(hdev); retval = hid_parse(hdev);
if (retval) { if (retval) {
hid_err(hdev, "parse failed\n"); hid_err(hdev, "parse failed\n");
......
...@@ -152,6 +152,9 @@ static int samsung_probe(struct hid_device *hdev, ...@@ -152,6 +152,9 @@ static int samsung_probe(struct hid_device *hdev,
int ret; int ret;
unsigned int cmask = HID_CONNECT_DEFAULT; unsigned int cmask = HID_CONNECT_DEFAULT;
if (!hid_is_usb(hdev))
return -EINVAL;
ret = hid_parse(hdev); ret = hid_parse(hdev);
if (ret) { if (ret) {
hid_err(hdev, "parse failed\n"); hid_err(hdev, "parse failed\n");
......
...@@ -3000,7 +3000,6 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -3000,7 +3000,6 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
sc->quirks = quirks; sc->quirks = quirks;
hid_set_drvdata(hdev, sc); hid_set_drvdata(hdev, sc);
sc->hdev = hdev; sc->hdev = hdev;
usbdev = to_usb_device(sc->hdev->dev.parent->parent);
ret = hid_parse(hdev); ret = hid_parse(hdev);
if (ret) { if (ret) {
...@@ -3038,14 +3037,23 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -3038,14 +3037,23 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
*/ */
if (!(hdev->claimed & HID_CLAIMED_INPUT)) { if (!(hdev->claimed & HID_CLAIMED_INPUT)) {
hid_err(hdev, "failed to claim input\n"); hid_err(hdev, "failed to claim input\n");
hid_hw_stop(hdev); ret = -ENODEV;
return -ENODEV; goto err;
} }
if (sc->quirks & (GHL_GUITAR_PS3WIIU | GHL_GUITAR_PS4)) { if (sc->quirks & (GHL_GUITAR_PS3WIIU | GHL_GUITAR_PS4)) {
if (!hid_is_usb(hdev)) {
ret = -EINVAL;
goto err;
}
usbdev = to_usb_device(sc->hdev->dev.parent->parent);
sc->ghl_urb = usb_alloc_urb(0, GFP_ATOMIC); sc->ghl_urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!sc->ghl_urb) if (!sc->ghl_urb) {
return -ENOMEM; ret = -ENOMEM;
goto err;
}
if (sc->quirks & GHL_GUITAR_PS3WIIU) if (sc->quirks & GHL_GUITAR_PS3WIIU)
ret = ghl_init_urb(sc, usbdev, ghl_ps3wiiu_magic_data, ret = ghl_init_urb(sc, usbdev, ghl_ps3wiiu_magic_data,
...@@ -3055,7 +3063,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -3055,7 +3063,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
ARRAY_SIZE(ghl_ps4_magic_data)); ARRAY_SIZE(ghl_ps4_magic_data));
if (ret) { if (ret) {
hid_err(hdev, "error preparing URB\n"); hid_err(hdev, "error preparing URB\n");
return ret; goto err;
} }
timer_setup(&sc->ghl_poke_timer, ghl_magic_poke, 0); timer_setup(&sc->ghl_poke_timer, ghl_magic_poke, 0);
...@@ -3064,6 +3072,10 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -3064,6 +3072,10 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
} }
return ret; return ret;
err:
hid_hw_stop(hdev);
return ret;
} }
static void sony_remove(struct hid_device *hdev) static void sony_remove(struct hid_device *hdev)
......
...@@ -274,6 +274,9 @@ static int thrustmaster_probe(struct hid_device *hdev, const struct hid_device_i ...@@ -274,6 +274,9 @@ static int thrustmaster_probe(struct hid_device *hdev, const struct hid_device_i
int ret = 0; int ret = 0;
struct tm_wheel *tm_wheel = NULL; struct tm_wheel *tm_wheel = NULL;
if (!hid_is_usb(hdev))
return -EINVAL;
ret = hid_parse(hdev); ret = hid_parse(hdev);
if (ret) { if (ret) {
hid_err(hdev, "parse failed with error %d\n", ret); hid_err(hdev, "parse failed with error %d\n", ret);
......
...@@ -311,7 +311,7 @@ static int u2fzero_probe(struct hid_device *hdev, ...@@ -311,7 +311,7 @@ static int u2fzero_probe(struct hid_device *hdev,
unsigned int minor; unsigned int minor;
int ret; int ret;
if (!hid_is_using_ll_driver(hdev, &usb_hid_driver)) if (!hid_is_usb(hdev))
return -EINVAL; return -EINVAL;
dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL); dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL);
......
...@@ -164,6 +164,9 @@ static int uclogic_probe(struct hid_device *hdev, ...@@ -164,6 +164,9 @@ static int uclogic_probe(struct hid_device *hdev,
struct uclogic_drvdata *drvdata = NULL; struct uclogic_drvdata *drvdata = NULL;
bool params_initialized = false; bool params_initialized = false;
if (!hid_is_usb(hdev))
return -EINVAL;
/* /*
* libinput requires the pad interface to be on a different node * libinput requires the pad interface to be on a different node
* than the pen, so use QUIRK_MULTI_INPUT for all tablets. * than the pen, so use QUIRK_MULTI_INPUT for all tablets.
......
...@@ -843,8 +843,7 @@ int uclogic_params_init(struct uclogic_params *params, ...@@ -843,8 +843,7 @@ int uclogic_params_init(struct uclogic_params *params,
struct uclogic_params p = {0, }; struct uclogic_params p = {0, };
/* Check arguments */ /* Check arguments */
if (params == NULL || hdev == NULL || if (params == NULL || hdev == NULL || !hid_is_usb(hdev)) {
!hid_is_using_ll_driver(hdev, &usb_hid_driver)) {
rc = -EINVAL; rc = -EINVAL;
goto cleanup; goto cleanup;
} }
......
...@@ -266,7 +266,8 @@ static void __maybe_unused ish_resume_handler(struct work_struct *work) ...@@ -266,7 +266,8 @@ static void __maybe_unused ish_resume_handler(struct work_struct *work)
if (ish_should_leave_d0i3(pdev) && !dev->suspend_flag if (ish_should_leave_d0i3(pdev) && !dev->suspend_flag
&& IPC_IS_ISH_ILUP(fwsts)) { && IPC_IS_ISH_ILUP(fwsts)) {
disable_irq_wake(pdev->irq); if (device_may_wakeup(&pdev->dev))
disable_irq_wake(pdev->irq);
ish_set_host_ready(dev); ish_set_host_ready(dev);
...@@ -337,7 +338,8 @@ static int __maybe_unused ish_suspend(struct device *device) ...@@ -337,7 +338,8 @@ static int __maybe_unused ish_suspend(struct device *device)
*/ */
pci_save_state(pdev); pci_save_state(pdev);
enable_irq_wake(pdev->irq); if (device_may_wakeup(&pdev->dev))
enable_irq_wake(pdev->irq);
} }
} else { } else {
/* /*
......
...@@ -726,7 +726,7 @@ static void wacom_retrieve_hid_descriptor(struct hid_device *hdev, ...@@ -726,7 +726,7 @@ static void wacom_retrieve_hid_descriptor(struct hid_device *hdev,
* Skip the query for this type and modify defaults based on * Skip the query for this type and modify defaults based on
* interface number. * interface number.
*/ */
if (features->type == WIRELESS) { if (features->type == WIRELESS && intf) {
if (intf->cur_altsetting->desc.bInterfaceNumber == 0) if (intf->cur_altsetting->desc.bInterfaceNumber == 0)
features->device_type = WACOM_DEVICETYPE_WL_MONITOR; features->device_type = WACOM_DEVICETYPE_WL_MONITOR;
else else
...@@ -2214,7 +2214,7 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix) ...@@ -2214,7 +2214,7 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
if ((features->type == HID_GENERIC) && !strcmp("Wacom HID", features->name)) { if ((features->type == HID_GENERIC) && !strcmp("Wacom HID", features->name)) {
char *product_name = wacom->hdev->name; char *product_name = wacom->hdev->name;
if (hid_is_using_ll_driver(wacom->hdev, &usb_hid_driver)) { if (hid_is_usb(wacom->hdev)) {
struct usb_interface *intf = to_usb_interface(wacom->hdev->dev.parent); struct usb_interface *intf = to_usb_interface(wacom->hdev->dev.parent);
struct usb_device *dev = interface_to_usbdev(intf); struct usb_device *dev = interface_to_usbdev(intf);
product_name = dev->product; product_name = dev->product;
...@@ -2451,6 +2451,9 @@ static void wacom_wireless_work(struct work_struct *work) ...@@ -2451,6 +2451,9 @@ static void wacom_wireless_work(struct work_struct *work)
wacom_destroy_battery(wacom); wacom_destroy_battery(wacom);
if (!usbdev)
return;
/* Stylus interface */ /* Stylus interface */
hdev1 = usb_get_intfdata(usbdev->config->interface[1]); hdev1 = usb_get_intfdata(usbdev->config->interface[1]);
wacom1 = hid_get_drvdata(hdev1); wacom1 = hid_get_drvdata(hdev1);
...@@ -2730,8 +2733,6 @@ static void wacom_mode_change_work(struct work_struct *work) ...@@ -2730,8 +2733,6 @@ static void wacom_mode_change_work(struct work_struct *work)
static int wacom_probe(struct hid_device *hdev, static int wacom_probe(struct hid_device *hdev,
const struct hid_device_id *id) const struct hid_device_id *id)
{ {
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
struct usb_device *dev = interface_to_usbdev(intf);
struct wacom *wacom; struct wacom *wacom;
struct wacom_wac *wacom_wac; struct wacom_wac *wacom_wac;
struct wacom_features *features; struct wacom_features *features;
...@@ -2766,8 +2767,14 @@ static int wacom_probe(struct hid_device *hdev, ...@@ -2766,8 +2767,14 @@ static int wacom_probe(struct hid_device *hdev,
wacom_wac->hid_data.inputmode = -1; wacom_wac->hid_data.inputmode = -1;
wacom_wac->mode_report = -1; wacom_wac->mode_report = -1;
wacom->usbdev = dev; if (hid_is_usb(hdev)) {
wacom->intf = intf; struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
struct usb_device *dev = interface_to_usbdev(intf);
wacom->usbdev = dev;
wacom->intf = intf;
}
mutex_init(&wacom->lock); mutex_init(&wacom->lock);
INIT_DELAYED_WORK(&wacom->init_work, wacom_init_work); INIT_DELAYED_WORK(&wacom->init_work, wacom_init_work);
INIT_WORK(&wacom->wireless_work, wacom_wireless_work); INIT_WORK(&wacom->wireless_work, wacom_wireless_work);
......
...@@ -840,6 +840,11 @@ static inline bool hid_is_using_ll_driver(struct hid_device *hdev, ...@@ -840,6 +840,11 @@ static inline bool hid_is_using_ll_driver(struct hid_device *hdev,
return hdev->ll_driver == driver; return hdev->ll_driver == driver;
} }
static inline bool hid_is_usb(struct hid_device *hdev)
{
return hid_is_using_ll_driver(hdev, &usb_hid_driver);
}
#define PM_HINT_FULLON 1<<5 #define PM_HINT_FULLON 1<<5
#define PM_HINT_NORMAL 1<<1 #define PM_HINT_NORMAL 1<<1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment