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.
Unified · Split
| @@ -1028,8 +1028,7 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) · 1027 unmodified lines | ||
| 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) { |
| @@ -1057,8 +1056,7 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) · 21 unmodified lines | ||
| 1057 | 1056 | drvdata->tp = &asus_t100chi_tp; |
| 1058 | 1057 | } |
| 1059 | 1058 | |
| 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)) { | |
| 1062 | 1060 | struct usb_host_interface *alt = |
| 1063 | 1061 | to_usb_interface(hdev->dev.parent)->altsetting; |
| 1064 | 1062 | |
| @@ -1777,7 +1777,7 @@ static int logi_dj_probe(struct hid_device *hdev, · 1776 unmodified lines | ||
| 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) { |
| @@ -311,7 +311,7 @@ static int u2fzero_probe(struct hid_device *hdev, · 310 unmodified lines | ||
| 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); |
| @@ -843,8 +843,7 @@ int uclogic_params_init(struct uclogic_params *params, · 842 unmodified lines | ||
| 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 | } |
| @@ -2214,7 +2214,7 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix) · 2213 unmodified lines | ||
| 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; |
| @@ -840,6 +840,11 @@ static inline bool hid_is_using_ll_driver(struct hid_device *hdev, · 839 unmodified lines | ||
| 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 | |