public inbox for linux-input@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Johan Hovold <johan@kernel.org>
Subject: [PATCH 1/4] Input: keyspan-remote - refactor endpoint lookup
Date: Mon, 30 Mar 2026 11:59:45 +0200	[thread overview]
Message-ID: <20260330095948.1663141-2-johan@kernel.org> (raw)
In-Reply-To: <20260330095948.1663141-1-johan@kernel.org>

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


  reply	other threads:[~2026-03-30 10:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30  9:59 [PATCH 0/4] Input: refactor USB endpoint lookups Johan Hovold
2026-03-30  9:59 ` Johan Hovold [this message]
2026-03-30  9:59 ` [PATCH 2/4] Input: appletouch - refactor endpoint lookup Johan Hovold
2026-03-30  9:59 ` [PATCH 3/4] Input: synaptics_usb " Johan Hovold
2026-03-30  9:59 ` [PATCH 4/4] Input: usbtouchscreen " Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260330095948.1663141-2-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox