Re: [PATCHv3 3/4] usb: gadget: rename usb_gadget_driver::speed tomax_speed

From: Alan Stern
Date: Fri Aug 19 2011 - 22:35:05 EST


On Sat, 20 Aug 2011, Felipe Balbi wrote:

> On Sat, Aug 20, 2011 at 12:33:01AM +0200, Michal Nazarewicz wrote:
> > From: Michal Nazarewicz <mina86@xxxxxxxxxx>
> >
> > This commit renames the âspeedâ field of the usb_gadget_driver
> > structure to âmax_speedâ. This is so that to make it more
> > apparent that the field represents the maximum speed gadget
> > driver can support.
> >
> > This also make the field look more like fields with the same
> > name in usb_gadget and usb_composite_driver structures. All
> > of those represent the *maximal* speed given entity supports.
> >
> > After this commit, there are the following fields in various
> > structures:
> > * usb_gadget::speed - the current connection speed,
> > * usb_gadget::max_speed - maximal speed UDC supports,
>
> this will be handled inside the UDC itself, so why do you need to expose
> it ?

I wondered about this too. It turns out that sometimes the gadget
driver really does need to know about the maximum speed supported by
the UDC hardware and driver.

For example, suppose the gadget driver and the UDC both support high
speed, but the gadget is currently plugged into a USB-1.1 controller
and therefore running only at full speed. Then the gadget driver has
to respond to the Get-Device-Qualifier and Get-Other-Speed-Config
requests by sending the appropriate descriptors. But if the UDC
doesn't support high speed operation then the gadget driver has to
respond to those requests with a STALL.

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/