]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
usb: gadget: udc-xilinx: Use USB API functions rather than constants
authorChen Ni <nichen@iscas.ac.cn>
Wed, 18 Jun 2025 04:12:22 +0000 (12:12 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jun 2025 10:24:03 +0000 (12:24 +0200)
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/20250618041222.408372-1-nichen@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/udc/udc-xilinx.c

index fa94cc0652742f695db053cdda322d9e3ea14c5f..8d803a612bb14d82237aa01d73281918e55a4eeb 100644 (file)
@@ -813,10 +813,10 @@ static int __xudc_ep_enable(struct xusb_ep *ep,
 
        ep->is_in = ((desc->bEndpointAddress & USB_DIR_IN) != 0);
        /* Bit 3...0:endpoint number */
-       ep->epnumber = (desc->bEndpointAddress & 0x0f);
+       ep->epnumber = usb_endpoint_num(desc);
        ep->desc = desc;
        ep->ep_usb.desc = desc;
-       tmp = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
+       tmp = usb_endpoint_type(desc);
        ep->ep_usb.maxpacket = maxpacket = le16_to_cpu(desc->wMaxPacketSize);
 
        switch (tmp) {