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

media: au0828: Use USB API functions rather than constants

Use the function usb_endpoint_dir_in() and usb_endpoint_type()
rather than constants.

The Coccinelle semantic patch is as follows:

@@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bEndpointAddress & \(USB_ENDPOINT_DIR_MASK\|0x80\)) ==
- \(USB_DIR_IN\|0x80\))
+ usb_endpoint_dir_in(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>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Chen Ni and committed by
Hans Verkuil
121c853e 5954ad7d

+2 -3
+2 -3
drivers/media/usb/au0828/au0828-video.c
··· 1921 1921 iface_desc = interface->cur_altsetting; 1922 1922 for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) { 1923 1923 endpoint = &iface_desc->endpoint[i].desc; 1924 - if (((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) 1925 - == USB_DIR_IN) && 1926 - ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) 1924 + if (usb_endpoint_dir_in(endpoint) && 1925 + (usb_endpoint_type(endpoint) 1927 1926 == USB_ENDPOINT_XFER_ISOC)) { 1928 1927 1929 1928 /* we find our isoc in endpoint */