]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
usb: gadget: pch_udc: Use USB API functions rather than constants
authorChen Ni <nichen@iscas.ac.cn>
Wed, 18 Jun 2025 04:09:08 +0000 (12:09 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jun 2025 10:24:05 +0000 (12:24 +0200)
Use the function usb_endpoint_type() rather than constants.

The Coccinelle semantic patch is as follows:

@@ 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/20250618040908.408309-1-nichen@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/udc/pch_udc.c

index 169f72665739feca100e5a65786ddd6af2cbd675..0b20ecbe64f9c1bacd9c19a3f81ede58d8e28209 100644 (file)
@@ -988,7 +988,7 @@ static void pch_udc_ep_enable(struct pch_udc_ep *ep,
        pch_udc_ep_fifo_flush(ep, ep->in);
        /* Configure the endpoint */
        val = ep->num << UDC_CSR_NE_NUM_SHIFT | ep->in << UDC_CSR_NE_DIR_SHIFT |
-             ((desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) <<
+             (usb_endpoint_type(desc) <<
                UDC_CSR_NE_TYPE_SHIFT) |
              (cfg->cur_cfg << UDC_CSR_NE_CFG_SHIFT) |
              (cfg->cur_intf << UDC_CSR_NE_INTF_SHIFT) |