Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: dwc2: gadget: Use USB API functions rather than constants

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/20250519062229.724664-1-nichen@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Chen Ni and committed by
Greg Kroah-Hartman
48175e2e eb25dcf0

+1 -1
+1 -1
drivers/usb/dwc2/gadget.c
··· 4049 4049 return -EINVAL; 4050 4050 } 4051 4051 4052 - ep_type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; 4052 + ep_type = usb_endpoint_type(desc); 4053 4053 mps = usb_endpoint_maxp(desc); 4054 4054 mc = usb_endpoint_maxp_mult(desc); 4055 4055