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

HID: Create a generic device group

Devices that do not have a special driver are handled by the generic
driver. This patch does the same thing using device groups; Instead of
forcing a particular driver, the appropriate driver is picked up by
udev. As a consequence, one can now move a device from generic to
specific handling by a simple rebind. By adding a new device id to the
generic driver, the same thing can be done in reverse.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Henrik Rydberg and committed by
Jiri Kosina
070748ed 7431fb76

+9 -16
+1 -8
drivers/hid/hid-core.c
··· 1800 1800 !strncmp(hdrv->name, "hid-multitouch", 14)) 1801 1801 return 1; 1802 1802 1803 - if (!hid_match_device(hdev, hdrv)) 1804 - return 0; 1805 - 1806 - /* generic wants all that don't have specialized driver */ 1807 - if (!strncmp(hdrv->name, "generic-", 8) && !hid_ignore_special_drivers) 1808 - return !hid_match_id(hdev, hid_have_special_driver); 1809 - 1810 - return 1; 1803 + return hid_match_device(hdev, hdrv) != NULL; 1811 1804 } 1812 1805 1813 1806 static int hid_device_probe(struct device *dev)
+1 -1
drivers/hid/usbhid/hid-core.c
··· 1505 1505 }; 1506 1506 1507 1507 static const struct hid_device_id hid_usb_table[] = { 1508 - { HID_USB_DEVICE(HID_ANY_ID, HID_ANY_ID) }, 1508 + { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, HID_ANY_ID, HID_ANY_ID) }, 1509 1509 { } 1510 1510 }; 1511 1511
+6 -6
include/linux/hid.h
··· 586 586 struct hid_class_descriptor desc[1]; 587 587 } __attribute__ ((packed)); 588 588 589 - #define HID_DEVICE(b, ven, prod) \ 590 - .bus = (b), \ 591 - .vendor = (ven), .product = (prod) 592 - 593 - #define HID_USB_DEVICE(ven, prod) HID_DEVICE(BUS_USB, ven, prod) 594 - #define HID_BLUETOOTH_DEVICE(ven, prod) HID_DEVICE(BUS_BLUETOOTH, ven, prod) 589 + #define HID_DEVICE(b, g, ven, prod) \ 590 + .bus = (b), .group = (g), .vendor = (ven), .product = (prod) 591 + #define HID_USB_DEVICE(ven, prod) \ 592 + .bus = BUS_USB, .vendor = (ven), .product = (prod) 593 + #define HID_BLUETOOTH_DEVICE(ven, prod) \ 594 + .bus = BUS_BLUETOOTH, .vendor = (ven), .product = (prod) 595 595 596 596 #define HID_REPORT_ID(rep) \ 597 597 .report_type = (rep)
+1 -1
net/bluetooth/hidp/core.c
··· 1196 1196 } 1197 1197 1198 1198 static const struct hid_device_id hidp_table[] = { 1199 - { HID_BLUETOOTH_DEVICE(HID_ANY_ID, HID_ANY_ID) }, 1199 + { HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_GENERIC, HID_ANY_ID, HID_ANY_ID) }, 1200 1200 { } 1201 1201 }; 1202 1202