From: Markus Elfring <Markus.Elfring@web.de>
To: linux-usb@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
"Al Viro" <viro@zeniv.linux.org.uk>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Yan Zhen" <yanzhen@vivo.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org, Chen Ni <nichen@iscas.ac.cn>
Subject: [PATCH] usb: gadget: fsl: Use usb_endpoint_type() rather than duplicating its implementation
Date: Tue, 24 Jun 2025 16:43:10 +0200 [thread overview]
Message-ID: <b4544835-2cac-4501-bcf4-6f105e3667d4@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 24 Jun 2025 16:33:53 +0200
Reuse existing functionality from usb_endpoint_type() instead of keeping
duplicate source code.
The source code was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/usb/gadget/udc/fsl_qe_udc.c | 4 ++--
drivers/usb/gadget/udc/fsl_udc_core.c | 6 ++----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c
index aacfde06387c..6ee3da32cc4e 100644
--- a/drivers/usb/gadget/udc/fsl_qe_udc.c
+++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
@@ -533,7 +533,7 @@ static int qe_ep_init(struct qe_udc *udc,
/* Refer to USB2.0 spec table 9-13,
*/
if (pipe_num != 0) {
- switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
+ switch (usb_endpoint_type(desc)) {
case USB_ENDPOINT_XFER_BULK:
if (strstr(ep->ep.name, "-iso")
|| strstr(ep->ep.name, "-int"))
@@ -636,7 +636,7 @@ static int qe_ep_init(struct qe_udc *udc,
/* initialize ep structure */
ep->ep.maxpacket = max;
- ep->tm = (u8)(desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK);
+ ep->tm = (u8) usb_endpoint_type(desc);
ep->ep.desc = desc;
ep->stopped = 0;
ep->init = 1;
diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index 4dea8bc30cf6..19c74ba82e16 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -599,16 +599,14 @@ static int fsl_ep_enable(struct usb_ep *_ep,
struct_ep_qh_setup(udc, (unsigned char) ep_index(ep),
(unsigned char) ((desc->bEndpointAddress & USB_DIR_IN)
? USB_SEND : USB_RECV),
- (unsigned char) (desc->bmAttributes
- & USB_ENDPOINT_XFERTYPE_MASK),
+ (unsigned char) usb_endpoint_type(desc),
max, zlt, mult);
/* Init endpoint ctrl register */
dr_ep_setup((unsigned char) ep_index(ep),
(unsigned char) ((desc->bEndpointAddress & USB_DIR_IN)
? USB_SEND : USB_RECV),
- (unsigned char) (desc->bmAttributes
- & USB_ENDPOINT_XFERTYPE_MASK));
+ (unsigned char) usb_endpoint_type(desc));
spin_unlock_irqrestore(&udc->lock, flags);
retval = 0;
--
2.50.0
reply other threads:[~2025-06-24 14:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=b4544835-2cac-4501-bcf4-6f105e3667d4@web.de \
--to=markus.elfring@web.de \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nichen@iscas.ac.cn \
--cc=u.kleine-koenig@baylibre.com \
--cc=viro@zeniv.linux.org.uk \
--cc=yanzhen@vivo.com \
/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