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

Configure Feed

Select the types of activity you want to include in your feed.

HID: add hid_is_usb() function to make it simpler for USB detection

A number of HID drivers already call hid_is_using_ll_driver() but only
for the detection of if this is a USB device or not. Make this more
obvious by creating hid_is_usb() and calling the function that way.

Also converts the existing hid_is_using_ll_driver() functions to use the
new call.

Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org
Cc: stable@vger.kernel.org
Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20211201183503.2373082-1-gregkh@linuxfoundation.org

authored by

Greg Kroah-Hartman and committed by
Benjamin Tissoires
f83baa0c 9003fbe0

+11 -9
+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-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) {
+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);
+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 }
+1 -1
drivers/hid/wacom_sys.c
··· 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;
+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