Skip to content

Commit a7675c1

Browse files
jhovolddtor
authored andcommitted
Input: keyspan-remote - 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> Link: https://patch.msgid.link/20260330095948.1663141-2-johan@kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 734fd5b commit a7675c1

1 file changed

Lines changed: 2 additions & 20 deletions

File tree

drivers/input/misc/keyspan_remote.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -420,24 +420,6 @@ static void keyspan_close(struct input_dev *dev)
420420
usb_kill_urb(remote->irq_urb);
421421
}
422422

423-
static struct usb_endpoint_descriptor *keyspan_get_in_endpoint(struct usb_host_interface *iface)
424-
{
425-
426-
struct usb_endpoint_descriptor *endpoint;
427-
int i;
428-
429-
for (i = 0; i < iface->desc.bNumEndpoints; ++i) {
430-
endpoint = &iface->endpoint[i].desc;
431-
432-
if (usb_endpoint_is_int_in(endpoint)) {
433-
/* we found our interrupt in endpoint */
434-
return endpoint;
435-
}
436-
}
437-
438-
return NULL;
439-
}
440-
441423
/*
442424
* Routine that sets up the driver to handle a specific USB device detected on the bus.
443425
*/
@@ -449,8 +431,8 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
449431
struct input_dev *input_dev;
450432
int i, error;
451433

452-
endpoint = keyspan_get_in_endpoint(interface->cur_altsetting);
453-
if (!endpoint)
434+
error = usb_find_int_in_endpoint(interface->cur_altsetting, &endpoint);
435+
if (error)
454436
return -ENODEV;
455437

456438
remote = kzalloc_obj(*remote);

0 commit comments

Comments
 (0)