Skip to content

Commit 03090cc

Browse files
committed
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
2 parents 2990c89 + 14902f8 commit 03090cc

36 files changed

+146
-36
lines changed

drivers/hid/Kconfig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ config HID_CHERRY
207207

208208
config HID_CHICONY
209209
tristate "Chicony devices"
210-
depends on HID
210+
depends on USB_HID
211211
default !EXPERT
212212
help
213213
Support for Chicony Tactical pad and special keys on Chicony keyboards.
214214

215215
config HID_CORSAIR
216216
tristate "Corsair devices"
217-
depends on HID && USB && LEDS_CLASS
217+
depends on USB_HID && LEDS_CLASS
218218
help
219219
Support for Corsair devices that are not fully compliant with the
220220
HID standard.
@@ -245,7 +245,7 @@ config HID_MACALLY
245245

246246
config HID_PRODIKEYS
247247
tristate "Prodikeys PC-MIDI Keyboard support"
248-
depends on HID && SND
248+
depends on USB_HID && SND
249249
select SND_RAWMIDI
250250
help
251251
Support for Prodikeys PC-MIDI Keyboard device support.
@@ -560,7 +560,7 @@ config HID_LENOVO
560560

561561
config HID_LOGITECH
562562
tristate "Logitech devices"
563-
depends on HID
563+
depends on USB_HID
564564
depends on LEDS_CLASS
565565
default !EXPERT
566566
help
@@ -951,7 +951,7 @@ config HID_SAITEK
951951

952952
config HID_SAMSUNG
953953
tristate "Samsung InfraRed remote control or keyboards"
954-
depends on HID
954+
depends on USB_HID
955955
help
956956
Support for Samsung InfraRed remote control or keyboards.
957957

drivers/hid/hid-asus.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,8 +1028,7 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
10281028
if (drvdata->quirks & QUIRK_IS_MULTITOUCH)
10291029
drvdata->tp = &asus_i2c_tp;
10301030

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)) {
10331032
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
10341033

10351034
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)
10571056
drvdata->tp = &asus_t100chi_tp;
10581057
}
10591058

1060-
if ((drvdata->quirks & QUIRK_MEDION_E1239T) &&
1061-
hid_is_using_ll_driver(hdev, &usb_hid_driver)) {
1059+
if ((drvdata->quirks & QUIRK_MEDION_E1239T) && hid_is_usb(hdev)) {
10621060
struct usb_host_interface *alt =
10631061
to_usb_interface(hdev->dev.parent)->altsetting;
10641062

drivers/hid/hid-bigbenff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static void bigben_worker(struct work_struct *work)
191191
struct bigben_device, worker);
192192
struct hid_field *report_field = bigben->report->field[0];
193193

194-
if (bigben->removed)
194+
if (bigben->removed || !report_field)
195195
return;
196196

197197
if (bigben->work_led) {

drivers/hid/hid-chicony.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ static int ch_probe(struct hid_device *hdev, const struct hid_device_id *id)
114114
{
115115
int ret;
116116

117+
if (!hid_is_usb(hdev))
118+
return -EINVAL;
119+
117120
hdev->quirks |= HID_QUIRK_INPUT_PER_APP;
118121
ret = hid_parse(hdev);
119122
if (ret) {

drivers/hid/hid-corsair.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,12 @@ static int corsair_probe(struct hid_device *dev, const struct hid_device_id *id)
553553
int ret;
554554
unsigned long quirks = id->driver_data;
555555
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);
557562

558563
drvdata = devm_kzalloc(&dev->dev, sizeof(struct corsair_drvdata),
559564
GFP_KERNEL);

drivers/hid/hid-elan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct elan_drvdata {
5050

5151
static int is_not_elan_touchpad(struct hid_device *hdev)
5252
{
53-
if (hdev->bus == BUS_USB) {
53+
if (hid_is_usb(hdev)) {
5454
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
5555

5656
return (intf->altsetting->desc.bInterfaceNumber !=

drivers/hid/hid-elo.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id)
230230
int ret;
231231
struct usb_device *udev;
232232

233+
if (!hid_is_usb(hdev))
234+
return -EINVAL;
235+
233236
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
234237
if (!priv)
235238
return -ENOMEM;

drivers/hid/hid-ft260.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,9 @@ static int ft260_probe(struct hid_device *hdev, const struct hid_device_id *id)
915915
struct ft260_get_chip_version_report version;
916916
int ret;
917917

918+
if (!hid_is_usb(hdev))
919+
return -EINVAL;
920+
918921
dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL);
919922
if (!dev)
920923
return -ENOMEM;

drivers/hid/hid-google-hammer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ static void hammer_remove(struct hid_device *hdev)
585585
static const struct hid_device_id hammer_devices[] = {
586586
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
587587
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_DON) },
588+
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
589+
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_EEL) },
588590
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
589591
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_HAMMER) },
590592
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,

drivers/hid/hid-holtek-kbd.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,17 @@ static int holtek_kbd_input_event(struct input_dev *dev, unsigned int type,
140140
static int holtek_kbd_probe(struct hid_device *hdev,
141141
const struct hid_device_id *id)
142142
{
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+
146+
if (!hid_is_usb(hdev))
147+
return -EINVAL;
145148

149+
ret = hid_parse(hdev);
146150
if (!ret)
147151
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
148152

153+
intf = to_usb_interface(hdev->dev.parent);
149154
if (!ret && intf->cur_altsetting->desc.bInterfaceNumber == 1) {
150155
struct hid_input *hidinput;
151156
list_for_each_entry(hidinput, &hdev->inputs, list) {

0 commit comments

Comments
 (0)