[PATCH 1/4] Input: keyspan-remote - refactor endpoint lookup

Johan Hovold posted 4 patches 1 week ago
[PATCH 1/4] Input: keyspan-remote - refactor endpoint lookup
Posted by Johan Hovold 1 week ago
Use the common USB helper for looking up interrupt-in endpoints instead
of open coding.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/input/misc/keyspan_remote.c | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c
index 152633bd2266..70cd6586459e 100644
--- a/drivers/input/misc/keyspan_remote.c
+++ b/drivers/input/misc/keyspan_remote.c
@@ -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);
-- 
2.52.0