mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-28 12:37:55 -05:00
usb: gadget: m66592-udc: Use USB API functions rather than constants
Use the function usb_endpoint_num() and usb_endpoint_type() 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) @@ struct usb_endpoint_descriptor *epd; @@ - (epd->bmAttributes & \(USB_ENDPOINT_XFERTYPE_MASK\|3\)) + usb_endpoint_type(epd) Signed-off-by: Chen Ni <nichen@iscas.ac.cn> Link: https://lore.kernel.org/r/20250618070714.817146-1-nichen@iscas.ac.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d9e496a9fb
commit
a4e668fd49
@@ -359,7 +359,7 @@ static void m66592_ep_setting(struct m66592 *m66592, struct m66592_ep *ep,
|
||||
ep->pipenum = pipenum;
|
||||
ep->ep.maxpacket = usb_endpoint_maxp(desc);
|
||||
m66592->pipenum2ep[pipenum] = ep;
|
||||
m66592->epaddr2ep[desc->bEndpointAddress&USB_ENDPOINT_NUMBER_MASK] = ep;
|
||||
m66592->epaddr2ep[usb_endpoint_num(desc)] = ep;
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ static int alloc_pipe_config(struct m66592_ep *ep,
|
||||
|
||||
BUG_ON(ep->pipenum);
|
||||
|
||||
switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
|
||||
switch (usb_endpoint_type(desc)) {
|
||||
case USB_ENDPOINT_XFER_BULK:
|
||||
if (m66592->bulk >= M66592_MAX_NUM_BULK) {
|
||||
if (m66592->isochronous >= M66592_MAX_NUM_ISOC) {
|
||||
@@ -433,7 +433,7 @@ static int alloc_pipe_config(struct m66592_ep *ep,
|
||||
}
|
||||
ep->type = info.type;
|
||||
|
||||
info.epnum = desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
|
||||
info.epnum = usb_endpoint_num(desc);
|
||||
info.maxpacket = usb_endpoint_maxp(desc);
|
||||
info.interval = desc->bInterval;
|
||||
if (desc->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
|
||||
|
||||
Reference in New Issue
Block a user