]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Input: keyspan-remote - refactor endpoint lookup
authorJohan Hovold <johan@kernel.org>
Mon, 30 Mar 2026 09:59:45 +0000 (11:59 +0200)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 30 Mar 2026 23:54:41 +0000 (16:54 -0700)
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>
drivers/input/misc/keyspan_remote.c

index 152633bd22661259f49e16675839e1ee5cca02dd..70cd6586459effec80a812f5134c6d7234a6b881 100644 (file)
@@ -420,24 +420,6 @@ static void keyspan_close(struct input_dev *dev)
        usb_kill_urb(remote->irq_urb);
 }
 
-static struct usb_endpoint_descriptor *keyspan_get_in_endpoint(struct usb_host_interface *iface)
-{
-
-       struct usb_endpoint_descriptor *endpoint;
-       int i;
-
-       for (i = 0; i < iface->desc.bNumEndpoints; ++i) {
-               endpoint = &iface->endpoint[i].desc;
-
-               if (usb_endpoint_is_int_in(endpoint)) {
-                       /* we found our interrupt in endpoint */
-                       return endpoint;
-               }
-       }
-
-       return NULL;
-}
-
 /*
  * Routine that sets up the driver to handle a specific USB device detected on the bus.
  */
@@ -449,8 +431,8 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
        struct input_dev *input_dev;
        int i, error;
 
-       endpoint = keyspan_get_in_endpoint(interface->cur_altsetting);
-       if (!endpoint)
+       error = usb_find_int_in_endpoint(interface->cur_altsetting, &endpoint);
+       if (error)
                return -ENODEV;
 
        remote = kzalloc_obj(*remote);