diff options
| author | Johan Hovold <johan@kernel.org> | 2026-03-30 12:50:34 +0300 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.com> | 2026-04-09 18:58:12 +0300 |
| commit | 2fcc5e0ee7989154c4a5d169bcc9565cf2d62147 (patch) | |
| tree | 53e113a8e9d3184dd1d77905ae0ea80e25ab6156 | |
| parent | 3d39be2a76d1dfed9ab74305bb5bb107a7d7ce67 (diff) | |
| download | linux-2fcc5e0ee7989154c4a5d169bcc9565cf2d62147.tar.xz | |
HID: usbhid: refactor endpoint lookup
Use the common USB helper for looking up interrupt-in endpoints instead
of open coding.
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
| -rw-r--r-- | drivers/hid/usbhid/hid-core.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index ddd5d77fb5a5..2447bc7cb7a1 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -1363,19 +1363,17 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id * { struct usb_host_interface *interface = intf->cur_altsetting; struct usb_device *dev = interface_to_usbdev(intf); + struct usb_endpoint_descriptor *ep; struct usbhid_device *usbhid; struct hid_device *hid; - unsigned int n, has_in = 0; size_t len; int ret; dbg_hid("HID probe called for ifnum %d\n", intf->altsetting->desc.bInterfaceNumber); - for (n = 0; n < interface->desc.bNumEndpoints; n++) - if (usb_endpoint_is_int_in(&interface->endpoint[n].desc)) - has_in++; - if (!has_in) { + ret = usb_find_int_in_endpoint(interface, &ep); + if (ret) { hid_err(intf, "couldn't find an input interrupt endpoint\n"); return -ENODEV; } |
