From nobody Mon Apr 6 11:53:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FAA03B6BED; Mon, 30 Mar 2026 10:00:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774864807; cv=none; b=iXyAzLfHsQS0UnZi7ZlUkhrC5qgvIphi6KcTH6wVUuX8VPNDfEh1cxdZaduV5fNgbtuVMjHyGdgGK4Bbo1hUPkMPalazajXrxWKOeA76i2iXwgXK11tGnaMIZkC2A289WsbE8+IjgWouHAmfNAwIYMibkkwFMJD6a8CmNqjswT8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774864807; c=relaxed/simple; bh=jPYqfrVJsg+9XnS7AWkksIvDFGqq18Z99brg532ZAp8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AvmN3snFc3qteQZeUlG6uyqEQm5J3hMddxLub5v2jw/h2ZS4HIx05GSM4+PJcnSwZD4uhMLfWJBWmJ6wbIlcUZpuHtUGFLr24AKk1ib+OzZShb05EnAMdlTcib8l4aawjAn3nXa3uANrSaEeqC9m1Pq7qdotK6si3mCP/YQ9m7o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cfJvNZp+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cfJvNZp+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1256C2BCB4; Mon, 30 Mar 2026 10:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774864806; bh=jPYqfrVJsg+9XnS7AWkksIvDFGqq18Z99brg532ZAp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cfJvNZp+3ilWC+e06rWNF5J7hSW6fRrW6te8J0N8k8OkGrZ/EsYzjbKLOHXhpnOT2 OZYM1nMD2sNe3uiOqHdV0HgaXNpHgvoLHmP3syZkQy2dCPMHvANrnCGRb2zifzQNXO yJN2xGu11C8YqEk789ckIglyZnKw2Qdu8zGJuA9mGgfcZlbpsJ8wNockjuKOdEVIMA 39DsQrQObd1ORbGzK0O4GW7nYCdmVhd5ZBA+Lwwl6V/5XfWQ7cctHf1IABVWaLbtT1 vHB7h0ldmpSRRFgqSDdF6TzmR6arL7+yxC0RFqcJDrYTq7T75bZzV0/NdxKSv/a/zx XpPJqAUJxjYvQ== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1w79Pg-00000006yfS-3J7O; Mon, 30 Mar 2026 12:00:04 +0200 From: Johan Hovold To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 1/4] Input: keyspan-remote - refactor endpoint lookup Date: Mon, 30 Mar 2026 11:59:45 +0200 Message-ID: <20260330095948.1663141-2-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260330095948.1663141-1-johan@kernel.org> References: <20260330095948.1663141-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the common USB helper for looking up interrupt-in endpoints instead of open coding. Signed-off-by: Johan Hovold --- 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/keysp= an_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); } =20 -static struct usb_endpoint_descriptor *keyspan_get_in_endpoint(struct usb_= host_interface *iface) -{ - - struct usb_endpoint_descriptor *endpoint; - int i; - - for (i =3D 0; i < iface->desc.bNumEndpoints; ++i) { - endpoint =3D &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 detecte= d on the bus. */ @@ -449,8 +431,8 @@ static int keyspan_probe(struct usb_interface *interfac= e, const struct usb_devic struct input_dev *input_dev; int i, error; =20 - endpoint =3D keyspan_get_in_endpoint(interface->cur_altsetting); - if (!endpoint) + error =3D usb_find_int_in_endpoint(interface->cur_altsetting, &endpoint); + if (error) return -ENODEV; =20 remote =3D kzalloc_obj(*remote); --=20 2.52.0 From nobody Mon Apr 6 11:53:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FBAF3B7B87; Mon, 30 Mar 2026 10:00:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774864807; cv=none; b=Y2sufzU1y4SKq9Hw6JFmaILUhYNIPulPYFHjPCFNjYcMJOnZXJPEau3KsYK17ue5EPRrhujt3nc+NEzlrB0BFYsui0PnRKKdRRDlQ8zt+tyGwvt1cbw3cYAuKTjvdLvt9s+wIu9+iFIPrVkIS65AQ5e6yjyyYbrqhqZAxj4lhus= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774864807; c=relaxed/simple; bh=uLZrGbmKmSUeJlzGFVn4O15k5z9DbQQi8RH35eZ3DJ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FpgwvAc8IOp4zSBrlCGEj2ZepEgIgrM79wvn55aQexVfYvyoBqv74sSQoHz7YM4ovTc0/BlCDmnsALFbRZTOx21pdOLjRtku1igbO7NkCmspzk4Lk2wYIW+5XG5ZvMTIe00BfEib/MJXICMoGwdACYsor02PEwAoYPiOZX9uVYY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=leqPetKN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="leqPetKN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E121FC4CEF7; Mon, 30 Mar 2026 10:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774864806; bh=uLZrGbmKmSUeJlzGFVn4O15k5z9DbQQi8RH35eZ3DJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=leqPetKN4g2Vj+8f8D/IYx2DJs2XzZUT+lLh+xnvgEfhpPc7jh1w6b+GPxo28dj4r WKKmUL21u63kh8fSAR5bdSwa79VUhkRYGstP+TML9PA0vTybVHqZyNljfwNrpET220 8z2Vc93Vo/msD6aXmMFB6dAuvs3SbOhDkkpx+SVDnGiiDhNgGcna4BlhlUjbDhfFDy y31X9DohKSpSdHv9eHY9aYrdToIhZznRS1RbHeArcwBbRHcehLqh/Sr/PEDXDvZUKY M+YJNEcZETUrsRrFVIsWnqHaL2P9YitjZJqm4Bz0HjRGijXMAR7bI4Dhcv9MMcfVa+ N7MOtgq5lTEEg== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1w79Pg-00000006yfV-3LSW; Mon, 30 Mar 2026 12:00:04 +0200 From: Johan Hovold To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 2/4] Input: appletouch - refactor endpoint lookup Date: Mon, 30 Mar 2026 11:59:46 +0200 Message-ID: <20260330095948.1663141-3-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260330095948.1663141-1-johan@kernel.org> References: <20260330095948.1663141-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the common USB helpers for looking up interrupt-in endpoints (and determining endpoint numbers) instead of open coding. Signed-off-by: Johan Hovold --- drivers/input/mouse/appletouch.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appleto= uch.c index 87d8f5afdfd9..eebeb57515e1 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c @@ -829,29 +829,20 @@ static int atp_probe(struct usb_interface *iface, struct atp *dev; struct input_dev *input_dev; struct usb_device *udev =3D interface_to_usbdev(iface); - struct usb_host_interface *iface_desc; - struct usb_endpoint_descriptor *endpoint; - int int_in_endpointAddr =3D 0; - int i, error =3D -ENOMEM; + struct usb_endpoint_descriptor *ep; + int error; const struct atp_info *info =3D (const struct atp_info *)id->driver_info; =20 /* set up the endpoint information */ /* use only the first interrupt-in endpoint */ - iface_desc =3D iface->cur_altsetting; - for (i =3D 0; i < iface_desc->desc.bNumEndpoints; i++) { - endpoint =3D &iface_desc->endpoint[i].desc; - if (!int_in_endpointAddr && usb_endpoint_is_int_in(endpoint)) { - /* we found an interrupt in endpoint */ - int_in_endpointAddr =3D endpoint->bEndpointAddress; - break; - } - } - if (!int_in_endpointAddr) { + error =3D usb_find_int_in_endpoint(iface->cur_altsetting, &ep); + if (error) { dev_err(&iface->dev, "Could not find int-in endpoint\n"); return -EIO; } =20 /* allocate memory for our device state and initialize it */ + error =3D -ENOMEM; dev =3D kzalloc_obj(*dev); input_dev =3D input_allocate_device(); if (!dev || !input_dev) { @@ -875,7 +866,7 @@ static int atp_probe(struct usb_interface *iface, goto err_free_urb; =20 usb_fill_int_urb(dev->urb, udev, - usb_rcvintpipe(udev, int_in_endpointAddr), + usb_rcvintpipe(udev, usb_endpoint_num(ep)), dev->data, dev->info->datalen, dev->info->callback, dev, 1); =20 --=20 2.52.0 From nobody Mon Apr 6 11:53:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C12B3B777E; Mon, 30 Mar 2026 10:00:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774864807; cv=none; b=ChY6Mggk8wjORdberQ1XBjkoEzFcGZTRU0x3DiFKbNJDn7i24xGUsv1fWlalmXtgF1/CFHQHGmpU/m7b4M5NLYDgx8IpO/kb5NaKtxFHy49CoEcR3rSuQuXRnpIhInKx6Ye6aiSdTRNz+ou1zor9xJtwPr1x8RE7q/ePiEIgONo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774864807; c=relaxed/simple; bh=ETuNAlVttgyljLvGjyhUwi+P1xNTdftDa3UpnFqoZ4I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eBO+qjK/qllknjxgBDvtrjYOTjsd2naoBOv3a8f5f0a3Hu/1BMQt7vnFtpHtZ8jL/J/azQMgVPUhNWn22gWUgQOQF101UJER7Lac/oqjr+cwGfsvR7kzSAepuKgWWvtZZR9bAFxB5mUKEd4SZxEV7DFoRha4QpOnHbQlyeKanzY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cFswPFTH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cFswPFTH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E44B9C4AF09; Mon, 30 Mar 2026 10:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774864806; bh=ETuNAlVttgyljLvGjyhUwi+P1xNTdftDa3UpnFqoZ4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cFswPFTHYi2i15W3KnvhGfMb8XzjtxO2Z6Lk554VKtr47rfFBGRwaWUGN8YUi4dPN E0muKn3NDbKc1K2PKyGuTz9yW1CtDaSUJ40ZvKSBvn8CFocq7YjK1Fud3xs8dkS0G3 07Y5u0BqKzKmNx2O3goT/icy7xWRC3KkeFo7F2N9brihDAFc7DNAbIgZ3t6bNa9BH8 mxyYWE+gBgkTI+9ByIV78z94n6687yG6koPjapJ9M+U6FGg9hr6HehP9yPALq85GWd EnxyA3nwNYTTaWDwb5gc0Z9nWiH73f0SBJG2LyJ+wIVONfxULSSptRBi5tpIJN22Fn DZ3F5y06Bk3dA== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1w79Pg-00000006yfX-3Nko; Mon, 30 Mar 2026 12:00:04 +0200 From: Johan Hovold To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 3/4] Input: synaptics_usb - refactor endpoint lookup Date: Mon, 30 Mar 2026 11:59:47 +0200 Message-ID: <20260330095948.1663141-4-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260330095948.1663141-1-johan@kernel.org> References: <20260330095948.1663141-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the common USB helper for looking up interrupt-in endpoints instead of open coding. Signed-off-by: Johan Hovold --- 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/syna= ptics_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); } =20 -static struct usb_endpoint_descriptor * -synusb_get_in_endpoint(struct usb_host_interface *iface) -{ - - struct usb_endpoint_descriptor *endpoint; - int i; - - for (i =3D 0; i < iface->desc.bNumEndpoints; ++i) { - endpoint =3D &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 =3D input_get_drvdata(dev); @@ -307,8 +288,8 @@ static int synusb_probe(struct usb_interface *intf, return error; } =20 - ep =3D synusb_get_in_endpoint(intf->cur_altsetting); - if (!ep) + error =3D usb_find_int_in_endpoint(intf->cur_altsetting, &ep); + if (error) return -ENODEV; =20 synusb =3D kzalloc_obj(*synusb); --=20 2.52.0 From nobody Mon Apr 6 11:53:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FA0D3B4EBC; Mon, 30 Mar 2026 10:00:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774864807; cv=none; b=UnW1+C/+QUtvLn44kxvIq4bmCh9d0AAVRxKPIjt83UeLql+MVAZalNWX/CeUTsxWuYt4z467djFOi3kj2h6Nhhq7I2NSQb9zOkYSpkQZUs/L2Lp7vwJUqS5pCqjgGLnVFsUZUuAxEmvMyu/uP95bbhaPqKZXkFrUr4LqwckKXRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774864807; c=relaxed/simple; bh=7+VHVjKGCdQxEWhptBkDrSh/FHonAepi3RRSoWJrvv4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mG+OWx3BJ4BrErsQQpmEPbiCQ8lI3O9XGe8AnN8oDAaEKCTlMl10ISYRwzPqdiFpolgNJikLWC8WAdUKwiSaq7q102vRfujQsIqr2JoVM5JDaSrqeerkVaPVMT6D2Unq8NyugvyCzQvh4cYRT78hPP3ZBtXxhOYOoqn+es4xJow= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=J5WKOkQV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="J5WKOkQV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB88AC2BCB1; Mon, 30 Mar 2026 10:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774864806; bh=7+VHVjKGCdQxEWhptBkDrSh/FHonAepi3RRSoWJrvv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J5WKOkQV9FqxA/nWu3LWmiJRCj9TT//ki6/Rv3vABcEg6g4kw6E+FTUrDRHlfunSy H1boIIyBhpszKOEMbGHMKFk+UJI2WhRyGin1X5FIPmUfnka9egUI9KY7wpnbq0Waxs X5ZFE7NZKpM2iuwnggTXMJQi//Fr1CeoVen9yXN57GJTtsojOObXX/iGfY+zclsFSx /FDvJ5xuFLXr1O+Dkap2xyZZ1AoJ9nlYkUWbiZaFu0uPW1QqxokP6a7xmkNBdAa2MN iBnj1YqmXGyBfafe9/tV9a4lbwT0JY80WvpMh/9rcrzjsmMOUDuH2v9BZb6qUi5cmt ykjj/CC6gQVWA== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1w79Pg-00000006yfZ-3Q9p; Mon, 30 Mar 2026 12:00:04 +0200 From: Johan Hovold To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 4/4] Input: usbtouchscreen - refactor endpoint lookup Date: Mon, 30 Mar 2026 11:59:48 +0200 Message-ID: <20260330095948.1663141-5-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260330095948.1663141-1-johan@kernel.org> References: <20260330095948.1663141-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the common USB helpers for looking up bulk and interrupt endpoints (and determining endpoint numbers) instead of open coding. Signed-off-by: Johan Hovold --- drivers/input/touchscreen/usbtouchscreen.c | 38 +++++++--------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/tou= chscreen/usbtouchscreen.c index 657555c8796c..edc809d0f773 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c @@ -969,24 +969,21 @@ static int nexio_init(struct usbtouch_usb *usbtouch) { struct usb_device *dev =3D interface_to_usbdev(usbtouch->interface); struct usb_host_interface *interface =3D usbtouch->interface->cur_altsett= ing; + struct usb_endpoint_descriptor *ep_in, *ep_out; struct nexio_priv *priv =3D usbtouch->priv; - int ret =3D -ENOMEM; int actual_len, i; char *firmware_ver =3D NULL, *device_name =3D NULL; - int input_ep =3D 0, output_ep =3D 0; + int input_ep, output_ep; + int ret; =20 /* find first input and output endpoint */ - for (i =3D 0; i < interface->desc.bNumEndpoints; i++) { - if (!input_ep && - usb_endpoint_dir_in(&interface->endpoint[i].desc)) - input_ep =3D interface->endpoint[i].desc.bEndpointAddress; - if (!output_ep && - usb_endpoint_dir_out(&interface->endpoint[i].desc)) - output_ep =3D interface->endpoint[i].desc.bEndpointAddress; - } - if (!input_ep || !output_ep) + ret =3D usb_find_common_endpoints(interface, &ep_in, &ep_out, NULL, NULL); + if (ret) return -ENXIO; =20 + input_ep =3D usb_endpoint_num(ep_in); + output_ep =3D usb_endpoint_num(ep_out); + u8 *buf __free(kfree) =3D kmalloc(NEXIO_BUFSIZE, GFP_NOIO); if (!buf) return -ENOMEM; @@ -1427,18 +1424,6 @@ static void usbtouch_free_buffers(struct usb_device = *udev, kfree(usbtouch->buffer); } =20 -static struct usb_endpoint_descriptor * -usbtouch_get_input_endpoint(struct usb_host_interface *interface) -{ - int i; - - for (i =3D 0; i < interface->desc.bNumEndpoints; i++) - if (usb_endpoint_dir_in(&interface->endpoint[i].desc)) - return &interface->endpoint[i].desc; - - return NULL; -} - static int usbtouch_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -1447,17 +1432,18 @@ static int usbtouch_probe(struct usb_interface *int= f, struct usb_endpoint_descriptor *endpoint; struct usb_device *udev =3D interface_to_usbdev(intf); const struct usbtouch_device_info *type; - int err =3D -ENOMEM; + int err; =20 /* some devices are ignored */ type =3D (const struct usbtouch_device_info *)id->driver_info; if (!type) return -ENODEV; =20 - endpoint =3D usbtouch_get_input_endpoint(intf->cur_altsetting); - if (!endpoint) + err =3D usb_find_int_in_endpoint(intf->cur_altsetting, &endpoint); + if (err) return -ENXIO; =20 + err =3D -ENOMEM; usbtouch =3D kzalloc_obj(*usbtouch); input_dev =3D input_allocate_device(); if (!usbtouch || !input_dev) --=20 2.52.0