[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250618035540.290411-1-nichen@iscas.ac.cn>
Date: Wed, 18 Jun 2025 11:55:40 +0800
From: Chen Ni <nichen@...as.ac.cn>
To: gregkh@...uxfoundation.org,
prashanth.k@....qualcomm.com,
jeff.johnson@....qualcomm.com,
Thinh.Nguyen@...opsys.com,
peter@...sgaard.com,
snovitoll@...il.com,
michal.vrastil@...global.com
Cc: linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org,
Chen Ni <nichen@...as.ac.cn>
Subject: [PATCH] usb: gadget: composite: Use USB API functions rather than constants
Use the function usb_endpoint_num() rather than constants.
The Coccinelle semantic patch is as follows:
@@ struct usb_endpoint_descriptor *epd; @@
- (epd->bEndpointAddress & \(USB_ENDPOINT_NUMBER_MASK\|0x0f\))
+ usb_endpoint_num(epd)
Signed-off-by: Chen Ni <nichen@...as.ac.cn>
---
drivers/usb/gadget/composite.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 8dbc132a505e..12634f0b45a8 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1011,7 +1011,7 @@ static int set_config(struct usb_composite_dev *cdev,
ep = (struct usb_endpoint_descriptor *)*descriptors;
addr = ((ep->bEndpointAddress & 0x80) >> 3)
- | (ep->bEndpointAddress & 0x0f);
+ | usb_endpoint_num(ep);
set_bit(addr, f->endpoints);
}
--
2.25.1
Powered by blists - more mailing lists