Skip to contentSkip to conversation

Staging: comedi: Use USB_ENDPOINT_DIR_MASK instead of USB_DIR_IN

PATCH In review Sandhya Bankar 2 participants 2 messages Sep 19, 2016 – Sep 20, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: comedi: Use USB_ENDPOINT_DIR_MASK instead of USB_DIR_IN

USB_ENDPOINT_DIR_MASK and USB_DIR_IN have the same value, but USB_ENDPOINT_DIR_MASK is more correct for use as a mask.

---
 drivers/staging/comedi/drivers/dt9812.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/comedi/drivers/dt9812.c +1 -1
index 7ebca86..40a7d97 100644
@@ -676,7 +676,7 @@ static int dt9812_find_endpoints(struct comedi_device *dev)
 			dir = USB_DIR_IN;
 			break;
 		}
-		if ((ep->bEndpointAddress & USB_DIR_IN) != dir) {
+		if ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != dir) {
 			dev_err(dev->class_dev,
 				"Endpoint has wrong direction\n");
 			return -ENODEV;
Signature · 1 line
1.7.1
maintainer
#1 lore raw
Quoted 13 lines · Sandhya Bankar

USB_ENDPOINT_DIR_MASK and USB_DIR_IN have the same value, but USB_ENDPOINT_DIR_MASK is more correct for use as a mask.

---
 drivers/staging/comedi/drivers/dt9812.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/comedi/drivers/dt9812.c +0 -0
index 7ebca86..40a7d97 100644

drivers/staging/comedi/drivers/dt9812.c static int dt9812_find_endpoints(struct comedi_device *dev) · line 679

Quoted 5 lines
drivers/staging/comedi/drivers/dt9812.c +1 -1
@@ -676,7 +676,7 @@ static int dt9812_find_endpoints(struct comedi_device *dev)
 			dir = USB_DIR_IN;
 			break;
 		}
-		if ((ep->bEndpointAddress & USB_DIR_IN) != dir) {
+		if ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != dir) {

This is messy, and I don't think that this code will ever "normally" be triggered. Can you rewrite this loop to properly check for the endpoint type using the functions you used last time, and not trigger off of the endpoint number? That would be a much cleaner and saner fix for this.

thanks,

greg k-h