[OPW,kernel,1/3] staging: ft1000: ft1000-usb: use USB API functions rather than constants
diff mbox

Message ID 00ab387578ac4a9e3109b50b10a405c3ff25115e.1414686497.git.tapaswenipathak@gmail.com
State New, archived
Headers show

Commit Message

Tapasweni Pathak Oct. 30, 2014, 4:32 p.m. UTC
This patch introduces the use of the functions usb_endpoint_type.

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)

Build tested it.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
---
 drivers/staging/ft1000/ft1000-usb/ft1000_usb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
1.7.9.5

Comments

Greg KH Oct. 30, 2014, 8:14 p.m. UTC | #1
On Thu, Oct 30, 2014 at 10:02:43PM +0530, Tapasweni Pathak wrote:
> This patch introduces the use of the functions usb_endpoint_type.
> 
> 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)
> 
> Build tested it.
> 
> Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
> ---
>  drivers/staging/ft1000/ft1000-usb/ft1000_usb.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
> index 39be30c..6eeea2e 100644
> --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
> +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
> @@ -115,7 +115,7 @@ static int ft1000_probe(struct usb_interface *interface,
>  		DEBUG("bEndpointAddress=%x, bmAttributes=%x\n",
>  		      endpoint->bEndpointAddress, endpoint->bmAttributes);
>  		if ((endpoint->bEndpointAddress & USB_DIR_IN)
> -		    && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
> +		    && (usb_endpoint_type(endpoint) ==
>  			USB_ENDPOINT_XFER_BULK)) {

Please fix up both of these to just use usb_endpoint_is_bulk_in(), which
combines both of these checks.


>  			ft1000dev->bulk_in_endpointAddr =
>  			    endpoint->bEndpointAddress;
> @@ -124,7 +124,7 @@ static int ft1000_probe(struct usb_interface *interface,
>  		}
> 
>  		if (!(endpoint->bEndpointAddress & USB_DIR_IN)
> -		    && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
> +		    && (usb_endpoint_type(endpoint) ==
>  			USB_ENDPOINT_XFER_BULK)) {

Same here, usb_endpoint_is_bulk_in() will work better.

thanks,

greg k-h

Patch
diff mbox

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
index 39be30c..6eeea2e 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
@@ -115,7 +115,7 @@  static int ft1000_probe(struct usb_interface *interface,
 		DEBUG("bEndpointAddress=%x, bmAttributes=%x\n",
 		      endpoint->bEndpointAddress, endpoint->bmAttributes);
 		if ((endpoint->bEndpointAddress & USB_DIR_IN)
-		    && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+		    && (usb_endpoint_type(endpoint) ==
 			USB_ENDPOINT_XFER_BULK)) {
 			ft1000dev->bulk_in_endpointAddr =
 			    endpoint->bEndpointAddress;
@@ -124,7 +124,7 @@  static int ft1000_probe(struct usb_interface *interface,
 		}

 		if (!(endpoint->bEndpointAddress & USB_DIR_IN)
-		    && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+		    && (usb_endpoint_type(endpoint) ==
 			USB_ENDPOINT_XFER_BULK)) {
 			ft1000dev->bulk_out_endpointAddr =
 			    endpoint->bEndpointAddress;