Re: [PATCH 2/2] usb/dummy_hcd: initialize max_streams early

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 3 Nov 2011, Sebastian Andrzej Siewior wrote:

> While playing with uasp I noticed that it does not work with dummy_hcd.
> The problem is that uasp requires a stream capable endpoint which it is
> requesting at bind time like every other gadget. dummy_hcd however
> initializes the max_stream value after connect once it knows if it runs
> at SS or not.
> I don't think that it is might be wrong to initialize the stream
> capability even at HS speed. The gadget may not use this descriptor at
> HS speed so it should not cause any damage.

This seems like a reasonable thing to do.

> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
>  drivers/usb/gadget/dummy_hcd.c |   12 +++---------
>  1 files changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
> index ab8f1b4..0b1e872 100644
> --- a/drivers/usb/gadget/dummy_hcd.c
> +++ b/drivers/usb/gadget/dummy_hcd.c
> @@ -800,17 +800,10 @@ static int dummy_set_selfpowered (struct usb_gadget *_gadget, int value)
>  
>  static void dummy_udc_udpate_ep0(struct dummy *dum)

While you're at it, do us all a favor and fix the spelling of this 
function's name.

>  {
> -	u32 i;
> -
> -	if (dum->gadget.speed == USB_SPEED_SUPER) {
> -		for (i = 0; i < DUMMY_ENDPOINTS; i++)
> -			dum->ep[i].ep.max_streams = 0x10;
> +	if (dum->gadget.speed == USB_SPEED_SUPER)
>  		dum->ep[0].ep.maxpacket = 9;
> -	} else {
> -		for (i = 0; i < DUMMY_ENDPOINTS; i++)
> -			dum->ep[i].ep.max_streams = 0;

It might be a good idea to keep this code -- just to be safe.

> +	else
>  		dum->ep[0].ep.maxpacket = 64;
> -	}
>  }
>  
>  static int dummy_pullup (struct usb_gadget *_gadget, int value)
> @@ -955,6 +948,7 @@ static void init_dummy_udc_hw(struct dummy *dum)
>  		ep->halted = ep->wedged = ep->already_seen =
>  				ep->setup_stage = 0;
>  		ep->ep.maxpacket = ~0;
> +		ep->ep.max_streams = 0x10;

Can we please just use a plain old "16" instead of "0x10"?  It's not 
like the max number of streams has some mystic binary significance.  I 
realize it was done this way in the original code, but that doesn't 
mean you have to copy it blindly.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux