Skip to contentSkip to conversation

usb: core: urb make use of usb_endpoint_maxp_mult

PATCH In review Mike Krinkin 3 participants 3 messages Nov 13, 2016 – Nov 14, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: core: urb make use of usb_endpoint_maxp_mult

Since usb_endpoint_maxp now returns only lower 11 bits mult calculation here isn't correct anymore and that breaks webcam for me. Patch make use of usb_endpoint_maxp_mult instead of direct calculation.

Fixes abb621844f6a ("usb: ch9: make usb_endpoint_maxp() return

only packet size")

---
 drivers/usb/core/urb.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/usb/core/urb.c +2 -5
index 0be49a1..d75cb8c 100644
@@ -412,11 +412,8 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
 		}
 
 		/* "high bandwidth" mode, 1-3 packets/uframe? */
-		if (dev->speed == USB_SPEED_HIGH) {
-			int	mult = 1 + ((max >> 11) & 0x03);
-			max &= 0x07ff;
-			max *= mult;
-		}
+		if (dev->speed == USB_SPEED_HIGH)
+			max *= usb_endpoint_maxp_mult(&ep->desc);
 
 		if (urb->number_of_packets <= 0)
 			return -EINVAL;
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 21 lines · Mike Krinkin

Since usb_endpoint_maxp now returns only lower 11 bits mult calculation here isn't correct anymore and that breaks webcam for me. Patch make use of usb_endpoint_maxp_mult instead of direct calculation.

Fixes abb621844f6a ("usb: ch9: make usb_endpoint_maxp() return

only packet size")

---
 drivers/usb/core/urb.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/usb/core/urb.c +0 -0
index 0be49a1..d75cb8c 100644
@@ -412,11 +412,8 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
 		}
 
 		/* "high bandwidth" mode, 1-3 packets/uframe? */

drivers/usb/core/urb.c int usb_submit_urb(struct urb *urb, gfp_t mem_flags) · line 419

Quoted 10 lines
drivers/usb/core/urb.c +2 -5
-		if (dev->speed == USB_SPEED_HIGH) {
-			int	mult = 1 + ((max >> 11) & 0x03);
-			max &= 0x07ff;
-			max *= mult;
-		}
+		if (dev->speed == USB_SPEED_HIGH)
+			max *= usb_endpoint_maxp_mult(&ep->desc);
 
 		if (urb->number_of_packets <= 0)
 			return -EINVAL;

Felipe, this looks like it belongs in your tree...

#2 lore raw

Hi,

Quoted 30 lines · Greg KH
Quoted 29 lines · Mike Krinkin

Since usb_endpoint_maxp now returns only lower 11 bits mult calculation here isn't correct anymore and that breaks webcam for me. Patch make use of usb_endpoint_maxp_mult instead of direct calculation.

Fixes abb621844f6a ("usb: ch9: make usb_endpoint_maxp() return

only packet size")

---
 drivers/usb/core/urb.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/usb/core/urb.c +2 -5
index 0be49a1..d75cb8c 100644
@@ -412,11 +412,8 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
 		}
 
 		/* "high bandwidth" mode, 1-3 packets/uframe? */
-		if (dev->speed == USB_SPEED_HIGH) {
-			int	mult = 1 + ((max >> 11) & 0x03);
-			max &= 0x07ff;
-			max *= mult;
-		}
+		if (dev->speed == USB_SPEED_HIGH)
+			max *= usb_endpoint_maxp_mult(&ep->desc);
 
Quoted 4 lines

drivers/usb/core/urb.c int usb_submit_urb(struct urb *urb, gfp_t mem_flags) · line 419

Quoted 2 lines
drivers/usb/core/urb.c +0 -0
 		if (urb->number_of_packets <= 0)
 			return -EINVAL;

Felipe, this looks like it belongs in your tree...

Right, I've queued it up :-)

Signature · 1 line
balbi