Linux CAN drivers development
 help / color / mirror / Atom feed
* [PATCH] can: ucan: Use usb_endpoint_type() rather than duplicating its implementation
@ 2025-06-24 17:12 Markus Elfring
  2025-06-24 17:29 ` Vincent Mailhol
  0 siblings, 1 reply; 16+ messages in thread
From: Markus Elfring @ 2025-06-24 17:12 UTC (permalink / raw)
  To: linux-can, Marc Kleine-Budde, Vincent Mailhol
  Cc: LKML, kernel-janitors, Chen Ni

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 24 Jun 2025 19:05:04 +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/net/can/usb/ucan.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c
index 07406daf7c88..3c8dad8bcca4 100644
--- a/drivers/net/can/usb/ucan.c
+++ b/drivers/net/can/usb/ucan.c
@@ -1353,16 +1353,14 @@ static int ucan_probe(struct usb_interface *intf,
 		ep = &iface_desc->endpoint[i].desc;
 
 		if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != 0) &&
-		    ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
-		     USB_ENDPOINT_XFER_BULK)) {
+		    usb_endpoint_type(ep) == USB_ENDPOINT_XFER_BULK) {
 			/* In Endpoint */
 			in_ep_addr = ep->bEndpointAddress;
 			in_ep_addr &= USB_ENDPOINT_NUMBER_MASK;
 			in_ep_size = le16_to_cpu(ep->wMaxPacketSize);
 		} else if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) ==
 			    0) &&
-			   ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
-			    USB_ENDPOINT_XFER_BULK)) {
+			   usb_endpoint_type(ep) == USB_ENDPOINT_XFER_BULK) {
 			/* Out Endpoint */
 			out_ep_addr = ep->bEndpointAddress;
 			out_ep_addr &= USB_ENDPOINT_NUMBER_MASK;
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-06-26 15:18 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-24 17:12 [PATCH] can: ucan: Use usb_endpoint_type() rather than duplicating its implementation Markus Elfring
2025-06-24 17:29 ` Vincent Mailhol
2025-06-24 18:28   ` Markus Elfring
2025-06-24 22:59     ` Vincent Mailhol
2025-06-25  5:47       ` [PATCH] " Markus Elfring
2025-06-25 15:51         ` Vincent Mailhol
2025-06-25 16:23           ` Markus Elfring
2025-06-26  2:47             ` Vincent Mailhol
2025-06-26  7:22               ` Markus Elfring
2025-06-26  9:23                 ` Vincent Mailhol
2025-06-26 14:46                   ` [PATCH v2] can: ucan: Use two USB endpoint API functions rather than duplicating their implementations Markus Elfring
2025-06-26 14:50                     ` Vincent Mailhol
2025-06-26 15:06                     ` Marc Kleine-Budde
2025-06-26 15:17                       ` [v2] " Markus Elfring
2025-06-24 19:21   ` [PATCH] can: ucan: Use usb_endpoint_type() rather than duplicating its implementation Markus Elfring
2025-06-24 23:03     ` Vincent Mailhol

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox