All of lore.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 3/4] Input: synaptics_usb - refactor endpoint lookup
Date: Mon, 30 Mar 2026 11:59:47 +0200	[thread overview]
Message-ID: <20260330095948.1663141-4-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/mouse/synaptics_usb.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/input/mouse/synaptics_usb.c b/drivers/input/mouse/synaptics_usb.c
index 5a86f6f387d8..880a0c79148c 100644
--- a/drivers/input/mouse/synaptics_usb.c
+++ b/drivers/input/mouse/synaptics_usb.c
@@ -220,25 +220,6 @@ static void synusb_irq(struct urb *urb)
 			__func__, error);
 }
 
-static struct usb_endpoint_descriptor *
-synusb_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;
-}
-
 static int synusb_open(struct input_dev *dev)
 {
 	struct synusb *synusb = input_get_drvdata(dev);
@@ -307,8 +288,8 @@ static int synusb_probe(struct usb_interface *intf,
 		return error;
 	}
 
-	ep = synusb_get_in_endpoint(intf->cur_altsetting);
-	if (!ep)
+	error = usb_find_int_in_endpoint(intf->cur_altsetting, &ep);
+	if (error)
 		return -ENODEV;
 
 	synusb = kzalloc_obj(*synusb);
-- 
2.52.0


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

Thread overview: 8+ 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 ` [PATCH 1/4] Input: keyspan-remote - refactor endpoint lookup Johan Hovold
2026-03-30  9:59 ` [PATCH 2/4] Input: appletouch " Johan Hovold
2026-03-30  9:59 ` Johan Hovold [this message]
2026-03-30  9:59 ` [PATCH 4/4] Input: usbtouchscreen " Johan Hovold
2026-03-30 23:55 ` [PATCH 0/4] Input: refactor USB endpoint lookups Dmitry Torokhov
2026-03-31 20:21   ` Dmitry Torokhov
2026-04-01  7:23     ` 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-4-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 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.