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

usb: gadget: udc: use USB API functions rather than constants

This patch introduces the use of the functions usb_endpoint_type and
usb_endpoint_num.

The Coccinelle semantic patch that makes these changes 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: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Himangi Saraogi and committed by
Felipe Balbi
b8adc3d1 457a0955

+3 -3
+3 -3
drivers/usb/gadget/udc/r8a66597-udc.c
··· 430 430 ep->pipenum = pipenum; 431 431 ep->ep.maxpacket = usb_endpoint_maxp(desc); 432 432 r8a66597->pipenum2ep[pipenum] = ep; 433 - r8a66597->epaddr2ep[desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK] 433 + r8a66597->epaddr2ep[usb_endpoint_num(desc)] 434 434 = ep; 435 435 INIT_LIST_HEAD(&ep->queue); 436 436 } ··· 464 464 if (ep->pipenum) /* already allocated pipe */ 465 465 return 0; 466 466 467 - switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) { 467 + switch (usb_endpoint_type(desc)) { 468 468 case USB_ENDPOINT_XFER_BULK: 469 469 if (r8a66597->bulk >= R8A66597_MAX_NUM_BULK) { 470 470 if (r8a66597->isochronous >= R8A66597_MAX_NUM_ISOC) { ··· 509 509 } 510 510 ep->type = info.type; 511 511 512 - info.epnum = desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; 512 + info.epnum = usb_endpoint_num(desc); 513 513 info.maxpacket = usb_endpoint_maxp(desc); 514 514 info.interval = desc->bInterval; 515 515 if (desc->bEndpointAddress & USB_ENDPOINT_DIR_MASK)