From nobody Mon Apr 6 09:08:14 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 3232F18FDDE; Mon, 30 Mar 2026 10:37:16 +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=1774867036; cv=none; b=CUrwRyQiw/p6yojD08qqeHaFAtCEFhwCCP1Pu3tixIlR2J9VjYsRaBHvVCuTrRfJSUkNOWExJZx5F70nLUeITBtmheRY0mN/LvAOsZVn0/B0/9dKkODPfOJtYiAKPIU0/zsZ/XzMD4nGXgf7rJ7vlsvUBGju7hAwg8tkjbDNi1Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774867036; c=relaxed/simple; bh=c1UJOJbhnuvVw3/vN6mUKkKNVK970uCZo6pBXU+o9IA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cd857QvDRaDgdvGQfStdD2xgrwD79x3euPJ+t8EDq3FYYKVKdb2ZDXQ6VsQonubYqFFWrUu95dm8k6KwFywvuf6xAZYdcSdHEnsAMJzjsh/gVqXkzlj9jSNCXuUaDSFDqHLQdLCCpWPe73zajDSJAdO7HAMrNVAlhgTOwR1LkZs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nAIeWD0i; 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="nAIeWD0i" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1365AC2BCB2; Mon, 30 Mar 2026 10:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774867036; bh=c1UJOJbhnuvVw3/vN6mUKkKNVK970uCZo6pBXU+o9IA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nAIeWD0i6VC1tfp5A2kCQfL3tngLxrZN+DrbMzGiBR6rNBSFvqZH33iJ+QNZlONOA 3ETP9RIRUXzUhanKZdUwk2C6+Ni7kp0UmQUxQtv88MlldSiEWVgnaW7kc57dxRYXbx KiLIaKJ+VF5rvqzJexITFZbzh8u/9/l6lGgP8/Eyw8ylDZ5sA78e2L/6BLGrQW8RyG KueATLMMfJGlIdsW0enD9vrtiUBrxXILIGuzqSyaaysrX+iqsqLJRO3popM8Z+6Ecr kBftVcnVe05FCFtI4wph7HsT38tFNYFflQK4NCaNf14lyrRYAXfqHPQxKkLxP6xqxQ tY7VKNTu6mK5A== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1w79ze-0000000713U-02T7; Mon, 30 Mar 2026 12:37:14 +0200 From: Johan Hovold To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 1/3] nfc: nfcmrvl: refactor endpoint lookup Date: Mon, 30 Mar 2026 12:36:53 +0200 Message-ID: <20260330103655.1672331-2-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260330103655.1672331-1-johan@kernel.org> References: <20260330103655.1672331-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 bulk and interrupt endpoints instead of open coding. Signed-off-by: Johan Hovold --- drivers/nfc/nfcmrvl/usb.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c index ea7309453096..6c4711c869f0 100644 --- a/drivers/nfc/nfcmrvl/usb.c +++ b/drivers/nfc/nfcmrvl/usb.c @@ -288,9 +288,9 @@ static int nfcmrvl_probe(struct usb_interface *intf, { struct nfcmrvl_usb_drv_data *drv_data; struct nfcmrvl_private *priv; - int i; struct usb_device *udev =3D interface_to_usbdev(intf); struct nfcmrvl_platform_data config; + int ret; =20 /* No configuration for USB */ memset(&config, 0, sizeof(config)); @@ -302,21 +302,9 @@ static int nfcmrvl_probe(struct usb_interface *intf, if (!drv_data) return -ENOMEM; =20 - for (i =3D 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) { - struct usb_endpoint_descriptor *ep_desc; - - ep_desc =3D &intf->cur_altsetting->endpoint[i].desc; - - if (!drv_data->bulk_tx_ep && - usb_endpoint_is_bulk_out(ep_desc)) { - drv_data->bulk_tx_ep =3D ep_desc; - } else if (!drv_data->bulk_rx_ep && - usb_endpoint_is_bulk_in(ep_desc)) { - drv_data->bulk_rx_ep =3D ep_desc; - } - } - - if (!drv_data->bulk_tx_ep || !drv_data->bulk_rx_ep) + ret =3D usb_find_common_endpoints(intf->cur_altsetting, &drv_data->bulk_r= x_ep, + &drv_data->bulk_tx_ep, NULL, NULL); + if (ret) return -ENODEV; =20 drv_data->udev =3D udev; --=20 2.52.0 From nobody Mon Apr 6 09:08:14 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 53D123BD640; Mon, 30 Mar 2026 10:37:16 +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=1774867036; cv=none; b=HqlXIeU5SIWf7vw2paBcTt33mWN/TL9JC78+AzQDBTzxZqf+019DCSPBfZ2pFIbDC29lLDwyfj1306b1cHVSywq5rDoNIZNetOaGgF+ZmUAPHe1rILQPcM7c0lGYlbM94rUX9RmqGHhBW3HbwMxRQzJUIFLz4nm48UV0pI6+uBM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774867036; c=relaxed/simple; bh=p7GepPmyAJRiDLZfTTTE//9a3j+GbLbQyAnUhYl/P3w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E9/56uQpDaWpx5ArjfdAzREAYM4bntGwQXNxU2ucwHVK5XKjmMwlf4I7wMY539UVqUpxviamfCqa2UHafCou6YeI+yPZgoeVeBP1C5Fft2jht6hlMKv8nm4ezMiMFyvYE1HfAdg3trNOAmMUCdYo0WtZBoG0r+Q/vOPghm1UQzU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AQwefIDK; 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="AQwefIDK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B272C4CEF7; Mon, 30 Mar 2026 10:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774867036; bh=p7GepPmyAJRiDLZfTTTE//9a3j+GbLbQyAnUhYl/P3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AQwefIDKLKiOyS8VuILVu71Uma+GriTd1FOPfWtSV6XvUwF1LbRgm7H8rH3GgPvq5 EyzT7jmKJQNXZnZAfvmwehrBO/jkponb0urWrosfrjoZhftPs+2VVG3IlaWJSmdMaY AqZazHBFK3+wsyOFTTGVXat0hiLcqyCDbFp+hdpe6GiIjDXsqeItuDlqorKKMo1/vE vSIHVDwtJ2YZiW8P644fi1jROB6fd9i3d0yzajOd4WDzLBDZQUDFeMCqzRplrwR9h+ BAPb0hZzne1gxYB4KRfWm7+IFPTao9rO+7MfE97JYTRpJ7QCq55d2a+uUU6TWU5Hoz La8eDJl/y1dyw== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1w79ze-0000000713W-05Xj; Mon, 30 Mar 2026 12:37:14 +0200 From: Johan Hovold To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 2/3] nfc: pn533: refactor endpoint lookup Date: Mon, 30 Mar 2026 12:36:54 +0200 Message-ID: <20260330103655.1672331-3-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260330103655.1672331-1-johan@kernel.org> References: <20260330103655.1672331-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/nfc/pn533/usb.c | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c index 0ff2f0d7caf4..efb07f944fce 100644 --- a/drivers/nfc/pn533/usb.c +++ b/drivers/nfc/pn533/usb.c @@ -476,14 +476,9 @@ static const struct pn533_phy_ops usb_phy_ops =3D { static int pn533_usb_probe(struct usb_interface *interface, const struct usb_device_id *id) { + struct usb_endpoint_descriptor *ep_in, *ep_out; struct pn533 *priv; struct pn533_usb_phy *phy; - struct usb_host_interface *iface_desc; - struct usb_endpoint_descriptor *endpoint; - int in_endpoint =3D 0; - int out_endpoint =3D 0; - int rc =3D -ENOMEM; - int i; u32 protocols; enum pn533_protocol_type protocol_type =3D PN533_PROTO_REQ_ACK_RESP; struct pn533_frame_ops *fops =3D NULL; @@ -491,6 +486,7 @@ static int pn533_usb_probe(struct usb_interface *interf= ace, int in_buf_len =3D PN533_EXT_FRAME_HEADER_LEN + PN533_STD_FRAME_MAX_PAYLOAD_LEN + PN533_STD_FRAME_TAIL_LEN; + int rc; =20 phy =3D devm_kzalloc(&interface->dev, sizeof(*phy), GFP_KERNEL); if (!phy) @@ -503,21 +499,11 @@ static int pn533_usb_probe(struct usb_interface *inte= rface, phy->udev =3D interface_to_usbdev(interface); phy->interface =3D interface; =20 - iface_desc =3D interface->cur_altsetting; - for (i =3D 0; i < iface_desc->desc.bNumEndpoints; ++i) { - endpoint =3D &iface_desc->endpoint[i].desc; - - if (!in_endpoint && usb_endpoint_is_bulk_in(endpoint)) - in_endpoint =3D endpoint->bEndpointAddress; - - if (!out_endpoint && usb_endpoint_is_bulk_out(endpoint)) - out_endpoint =3D endpoint->bEndpointAddress; - } - - if (!in_endpoint || !out_endpoint) { + rc =3D usb_find_common_endpoints(interface->cur_altsetting, &ep_in, + &ep_out, NULL, NULL); + if (rc) { nfc_err(&interface->dev, "Could not find bulk-in or bulk-out endpoint\n"); - rc =3D -ENODEV; goto error; } =20 @@ -525,18 +511,20 @@ static int pn533_usb_probe(struct usb_interface *inte= rface, phy->out_urb =3D usb_alloc_urb(0, GFP_KERNEL); phy->ack_urb =3D usb_alloc_urb(0, GFP_KERNEL); =20 - if (!phy->in_urb || !phy->out_urb || !phy->ack_urb) + if (!phy->in_urb || !phy->out_urb || !phy->ack_urb) { + rc =3D -ENOMEM; goto error; + } =20 usb_fill_bulk_urb(phy->in_urb, phy->udev, - usb_rcvbulkpipe(phy->udev, in_endpoint), + usb_rcvbulkpipe(phy->udev, usb_endpoint_num(ep_in)), in_buf, in_buf_len, NULL, phy); =20 usb_fill_bulk_urb(phy->out_urb, phy->udev, - usb_sndbulkpipe(phy->udev, out_endpoint), + usb_sndbulkpipe(phy->udev, usb_endpoint_num(ep_out)), NULL, 0, pn533_out_complete, phy); usb_fill_bulk_urb(phy->ack_urb, phy->udev, - usb_sndbulkpipe(phy->udev, out_endpoint), + usb_sndbulkpipe(phy->udev, usb_endpoint_num(ep_out)), NULL, 0, pn533_ack_complete, phy); =20 switch (id->driver_info) { --=20 2.52.0 From nobody Mon Apr 6 09:08:14 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 3E6FE2749EA; Mon, 30 Mar 2026 10:37:16 +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=1774867036; cv=none; b=s05bE+0B94Jb6+hQ4sEXWFU6v2jpz8MPJlSzHd06ictQFRa9ObkopI2XVvUprxzWcxe9JqhqORYT1FULjr/0tHl+oDHwWGfdkCiwooI7odQDKYnt8ELYqZtAuhaGSb11aBpB4TzSctYuCEej4Zq/7qDjnbuZQIEq3zg5ZA2Q3n0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774867036; c=relaxed/simple; bh=oMwbOvekEJLq5SWnvcRHTW8y++ihCP2psVy2WWx82ng=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HUcCa352tcIWbCeG29QsKOu4QtSMB/Hdbzi+F2pHqLRe5L4d3DV0iiFWpyXwrDvuWwdgtriqcW5Ta8epJckVSYRB+GXRV/DCyofMq9S9gPQHfTo+Ee+HQFvBA+lLJ0jUHaY1kYmHphaHu3bFH1ReuwHQVFzBBALZNiKVo/ff4bg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=J4zgJAot; 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="J4zgJAot" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FBFEC2BC9E; Mon, 30 Mar 2026 10:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774867036; bh=oMwbOvekEJLq5SWnvcRHTW8y++ihCP2psVy2WWx82ng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J4zgJAot4NpPX7qtWkNar85h4ipj56p6iLi4w+feOXBVh0zp6Aie8l75QHlVpRPZ3 78gmFJaCnAZiQozK5u3E5VG/CTxvPpC3x9zQJ+/11LfqQuyKgYaDD/oma3Tnz5W+CO xouL3OAmxc+G7flz1MhsqiP20dwBhpQxRlbMC3lRqauSupAa1RSm+zA/MdbKt0MtzT tDckSaYiip/V+y1toBAV7i91bzjnZGnKSV/4dK3HJ7kd5XXtmhP8E3SDkyqZ+u7h57 dhIX1eRzaaWwTAOiyxGbnVuyVBNZfdGbBL1a300yG19RHFvNjFdY4XgKQ63Cc7/C+/ JLccavImZNZbw== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1w79ze-0000000713Z-08W7; Mon, 30 Mar 2026 12:37:14 +0200 From: Johan Hovold To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 3/3] nfc: port100: refactor endpoint lookup Date: Mon, 30 Mar 2026 12:36:55 +0200 Message-ID: <20260330103655.1672331-4-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260330103655.1672331-1-johan@kernel.org> References: <20260330103655.1672331-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/nfc/port100.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c index 09dcc6f4c4f3..5ae61d7ebcfe 100644 --- a/drivers/nfc/port100.c +++ b/drivers/nfc/port100.c @@ -1489,15 +1489,11 @@ MODULE_DEVICE_TABLE(usb, port100_table); static int port100_probe(struct usb_interface *interface, const struct usb_device_id *id) { + struct usb_endpoint_descriptor *ep_in, *ep_out; struct port100 *dev; int rc; - struct usb_host_interface *iface_desc; - struct usb_endpoint_descriptor *endpoint; - int in_endpoint; - int out_endpoint; u16 fw_version; u64 cmd_type_mask; - int i; =20 dev =3D devm_kzalloc(&interface->dev, sizeof(struct port100), GFP_KERNEL); if (!dev) @@ -1508,22 +1504,11 @@ static int port100_probe(struct usb_interface *inte= rface, dev->interface =3D interface; usb_set_intfdata(interface, dev); =20 - in_endpoint =3D out_endpoint =3D 0; - iface_desc =3D interface->cur_altsetting; - for (i =3D 0; i < iface_desc->desc.bNumEndpoints; ++i) { - endpoint =3D &iface_desc->endpoint[i].desc; - - if (!in_endpoint && usb_endpoint_is_bulk_in(endpoint)) - in_endpoint =3D endpoint->bEndpointAddress; - - if (!out_endpoint && usb_endpoint_is_bulk_out(endpoint)) - out_endpoint =3D endpoint->bEndpointAddress; - } - - if (!in_endpoint || !out_endpoint) { + rc =3D usb_find_common_endpoints(interface->cur_altsetting, &ep_in, + &ep_out, NULL, NULL); + if (rc) { nfc_err(&interface->dev, "Could not find bulk-in or bulk-out endpoint\n"); - rc =3D -ENODEV; goto error; } =20 @@ -1537,10 +1522,10 @@ static int port100_probe(struct usb_interface *inte= rface, } =20 usb_fill_bulk_urb(dev->in_urb, dev->udev, - usb_rcvbulkpipe(dev->udev, in_endpoint), + usb_rcvbulkpipe(dev->udev, usb_endpoint_num(ep_in)), NULL, 0, NULL, dev); usb_fill_bulk_urb(dev->out_urb, dev->udev, - usb_sndbulkpipe(dev->udev, out_endpoint), + usb_sndbulkpipe(dev->udev, usb_endpoint_num(ep_out)), NULL, 0, port100_send_complete, dev); dev->out_urb->transfer_flags =3D URB_ZERO_PACKET; =20 --=20 2.52.0