Re: [PATCH 1/3] usb: udc: Fix gadget driver's speed check in variousUDC drivers

From: Alan Stern
Date: Sat Nov 19 2011 - 16:03:56 EST


On Sat, 19 Nov 2011, Michal Nazarewicz wrote:

> From: Michal Nazarewicz <mina86@xxxxxxxxxx>
>
> Several UDC drivers had a gadget driver's speed sanity check of the
> form of:
>
> driver->speed != USB_SPEED_HIGH
>
> or:
>
> driver->speed != USB_SPEED_HIGH && driver->speed != USB_SPEED_FULL
>
> As more and more gadget drivers support USB SuperSpeed, driver->speed
> may be set to USB_SPEED_SUPER and UDC driver should handle such gadget
> correctly. The above checks however fail to recognise USB_SPEED_SUPER
> as a valid speed.
>
> This commit changes the two checks to:
>
> driver->speed < USB_SPEED_HIGH
>
> or:
>
> driver->speed < USB_SPEED_FULL
>
> respectively.
>
> Signed-off-by: Michal Nazarewicz <mina86@xxxxxxxxxx>
> Reported-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> ---
>
> I had no way of testing those changes but it appears that those UDC
> drivers check gadget driver's speed only on the entry point and then
> nothing is really dependent on it.

That's right; the idea is merely to avoid connecting at a speed that's
too fast for the gadget driver to handle.

> The only thing that makes me wonder a little is that
> USB_SPEED_WIRELESS will be allowed by the above checks and I'm not
> entirely sure if that's desired (even though that's probably not an
> issue right now).

I agree, wireless will eventually pose a problem. Let's not worry
about it for now, though.

> Nonetheless, this patch needs to get merged to 3.2 as without it
> file_storage won't work on UDC drivers this patch updates.
>
> The next two patches that follow this one are replacements for
> [291a72f8: usb: gadget: replace usb_gadget::is_dualspeed with
> max_speed] and [d93bb846: usb: gadget: rename usb_gadget_driver::speed
> to max_speed] from Felipe's gadget tree, which did not apply correctly
> on top of this patch.

This all looks very good. Thanks for doing the work.

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/