Skip to contentSkip to conversation

Staging: media: lirc: Use USB API functions rather than constants

PATCH Superseded Shraddha Barke 2 participants 2 messages Sep 29, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: media: lirc: Use USB API functions rather than constants

Introduce the use of the function usb_endpoint_type.

The Coccinelle semantic patch that makes these changes is as follows:

@@ struct usb_endpoint_descriptor *epd; @@

- (epd->bmAttributes & \(USB_ENDPOINT_XFERTYPE_MASK\|3\))
+ usb_endpoint_type(epd)

---
 drivers/staging/media/lirc/lirc_sasem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/lirc/lirc_sasem.c +1 -1
index b247649a..4230c00 100644
@@ -702,7 +702,7 @@ static int sasem_probe(struct usb_interface *interface,
 
 		ep = &iface_desc->endpoint [i].desc;
 		ep_dir = ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK;
-		ep_type = ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
+		ep_type = usb_endpoint_type(ep);
 
 		if (!ir_ep_found &&
 			ep_dir == USB_DIR_IN &&
Signature · 1 line
2.1.4
maintainer
#1 lore raw
Quoted 19 lines · Shraddha Barke

Introduce the use of the function usb_endpoint_type.

The Coccinelle semantic patch that makes these changes is as follows:

@@ struct usb_endpoint_descriptor *epd; @@

- (epd->bmAttributes & \(USB_ENDPOINT_XFERTYPE_MASK\|3\))
+ usb_endpoint_type(epd)

---
 drivers/staging/media/lirc/lirc_sasem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/lirc/lirc_sasem.c +0 -0
index b247649a..4230c00 100644

drivers/staging/media/lirc/lirc_sasem.c static int sasem_probe(struct usb_interface *interface, · line 708

Quoted 8 lines
drivers/staging/media/lirc/lirc_sasem.c +1 -1
@@ -702,7 +702,7 @@ static int sasem_probe(struct usb_interface *interface,
 
 		ep = &iface_desc->endpoint [i].desc;
 		ep_dir = ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK;
-		ep_type = ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
+		ep_type = usb_endpoint_type(ep);
 
 		if (!ir_ep_found &&
 			ep_dir == USB_DIR_IN &&

The ep_type and ep_dir variables can just go away and you can use the functions like usb_endpoint_is_int_in() for testing this type of thing. Please do that instead.

thanks,

greg k-h