Re: [PATCHv3 4/4] usb: gadget: get rid of USB_GADGET_{DUAL,SUPER}SPEED

From: Alan Stern
Date: Sat Aug 20 2011 - 09:41:37 EST


On Sat, 20 Aug 2011, Michal Nazarewicz wrote:

> From: Michal Nazarewicz <mina86@xxxxxxxxxx>
>
> This commit removes USB_GADGET_DUALSPEED and USB_GADGET_SUPERSPEED
> Kconfig options. Since now kernel allows many UDC drivers to be
> compiled, those options may turn to no longer be valid. For
> instance, if someone decides to build UDC that supports super
> speed and UDC that supports high speed only, the latter will be
> "assumed" to support super speed since USB_GADGET_SUPERSPEED will
> be selected by the former.
>
> The test of whether CONFIG_USB_GADGET_*SPEED was defined was just
> an optimisation which removed otherwise dead code (ie. if UDC is
> not dual speed, there is no need to handle cases that can happen
> if speed is high). This commit removes those checks.
>
> Signed-off-by: Michal Nazarewicz <mina86@xxxxxxxxxx>

...

> --- a/drivers/usb/gadget/dummy_hcd.c
> +++ b/drivers/usb/gadget/dummy_hcd.c
> @@ -985,7 +985,7 @@ static int dummy_udc_probe (struct platform_device *pdev)
>
> dum->gadget.name = gadget_name;
> dum->gadget.ops = &dummy_ops;
> - dum->gadget.max_speed = USB_SPEED_SUPER;;
> + dum->gadget.max_speed = USB_SPEED_SUPER;

You might as well get this right in patch 2/4. Then this hunk
wouldn't be needed.


> --- a/drivers/usb/gadget/inode.c
> +++ b/drivers/usb/gadget/inode.c
...
> @@ -1773,11 +1767,7 @@ gadgetfs_suspend (struct usb_gadget *gadget)
> }
>
> static struct usb_gadget_driver gadgetfs_driver = {
> -#ifdef CONFIG_USB_GADGET_DUALSPEED
> .max_speed = USB_SPEED_HIGH,
> -#else
> - .max_speed = USB_SPEED_FULL,
> -#endif

I'm not sure that a static definition is correct here. The actual
max_speed depends on what descriptors the userspace program sends.
Take a look at the ep_config() routine.

Alan Stern

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