]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
usb: gadget: dummy_hcd: Use USB API functions rather than constants
authorChen Ni <nichen@iscas.ac.cn>
Wed, 18 Jun 2025 06:57:50 +0000 (14:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jun 2025 10:25:16 +0000 (12:25 +0200)
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@iscas.ac.cn>
Link: https://lore.kernel.org/r/20250618065750.816965-1-nichen@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/udc/dummy_hcd.c

index 27c9699365ab951256147094d8960be4d6732bbd..21dbfb0b3baca893fd0ed07c8e83353ad64e2666 100644 (file)
@@ -623,7 +623,7 @@ static int dummy_enable(struct usb_ep *_ep,
 
        dev_dbg(udc_dev(dum), "enabled %s (ep%d%s-%s) maxpacket %d stream %s\n",
                _ep->name,
-               desc->bEndpointAddress & 0x0f,
+               usb_endpoint_num(desc),
                (desc->bEndpointAddress & USB_DIR_IN) ? "in" : "out",
                usb_ep_type_string(usb_endpoint_type(desc)),
                max, str_enabled_disabled(ep->stream_en));