linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: core: urb make use of usb_endpoint_maxp_mult
@ 2016-11-13 10:31 Mike Krinkin
  2016-11-14  9:21 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Krinkin @ 2016-11-13 10:31 UTC (permalink / raw)
  To: linux-usb
  Cc: felipe.balbi, gregkh, linux-media, mchehab, laurent.pinchart,
	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")

Signed-off-by: Mike Krinkin <krinkin.m.u@gmail.com>
---
 drivers/usb/core/urb.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 0be49a1..d75cb8c 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -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;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: core: urb make use of usb_endpoint_maxp_mult
  2016-11-13 10:31 [PATCH] usb: core: urb make use of usb_endpoint_maxp_mult Mike Krinkin
@ 2016-11-14  9:21 ` Greg KH
  2016-11-14  9:27   ` Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2016-11-14  9:21 UTC (permalink / raw)
  To: Mike Krinkin
  Cc: linux-usb, felipe.balbi, linux-media, mchehab, laurent.pinchart

On Sun, Nov 13, 2016 at 01:31:16PM +0300, Mike Krinkin wrote:
> 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")
> 
> Signed-off-by: Mike Krinkin <krinkin.m.u@gmail.com>
> ---
>  drivers/usb/core/urb.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
> index 0be49a1..d75cb8c 100644
> --- a/drivers/usb/core/urb.c
> +++ b/drivers/usb/core/urb.c
> @@ -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;

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: core: urb make use of usb_endpoint_maxp_mult
  2016-11-14  9:21 ` Greg KH
@ 2016-11-14  9:27   ` Felipe Balbi
  0 siblings, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2016-11-14  9:27 UTC (permalink / raw)
  To: Greg KH, Mike Krinkin; +Cc: linux-usb, linux-media, mchehab, laurent.pinchart

[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]


Hi,

Greg KH <gregkh@linuxfoundation.org> writes:
> On Sun, Nov 13, 2016 at 01:31:16PM +0300, Mike Krinkin wrote:
>> 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")
>> 
>> Signed-off-by: Mike Krinkin <krinkin.m.u@gmail.com>
>> ---
>>  drivers/usb/core/urb.c | 7 ++-----
>>  1 file changed, 2 insertions(+), 5 deletions(-)
>> 
>> diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
>> index 0be49a1..d75cb8c 100644
>> --- a/drivers/usb/core/urb.c
>> +++ b/drivers/usb/core/urb.c
>> @@ -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;
>
> Felipe, this looks like it belongs in your tree...

Right, I've queued it up :-)

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-14  9:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-13 10:31 [PATCH] usb: core: urb make use of usb_endpoint_maxp_mult Mike Krinkin
2016-11-14  9:21 ` Greg KH
2016-11-14  9:27   ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).