* [PATCH] HID: usbhid: refactor endpoint lookup
@ 2026-03-30 9:50 Johan Hovold
2026-04-09 15:58 ` Jiri Kosina
0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2026-03-30 9:50 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires
Cc: linux-usb, linux-input, linux-kernel, Johan Hovold
Use the common USB helper for looking up interrupt-in endpoints instead
of open coding.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/hid/usbhid/hid-core.c | 8 +++-----
1 file 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;
}
--
2.52.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] HID: usbhid: refactor endpoint lookup
2026-03-30 9:50 [PATCH] HID: usbhid: refactor endpoint lookup Johan Hovold
@ 2026-04-09 15:58 ` Jiri Kosina
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2026-04-09 15:58 UTC (permalink / raw)
To: Johan Hovold; +Cc: Benjamin Tissoires, linux-usb, linux-input, linux-kernel
On Mon, 30 Mar 2026, Johan Hovold wrote:
> Use the common USB helper for looking up interrupt-in endpoints instead
> of open coding.
Good catch, thanks Johan. Now applied to hid.git#for-7.1/core-v2.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-09 15:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30 9:50 [PATCH] HID: usbhid: refactor endpoint lookup Johan Hovold
2026-04-09 15:58 ` Jiri Kosina
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.