RE: [PATCH v4 1/4] usb gadget: Add usb_endpoint_descriptor to be part of the struct usb_ep

From: Tanya Brokhman
Date: Thu Jan 27 2011 - 08:19:03 EST


> On Thu, Nov 18, 2010 at 02:46:38PM +0200, Tatyana Brokhman wrote:
> > Change usb_ep_enable() prototype to use endpoint descriptor from
> usb_ep.
> > This optimization spares the FDs from saving the endpoint chosen
> > descriptor.
>
> Why is this a good thing to do?
>

Because the FDs don't modify the ep descriptor, just pass it through
different functions so there is no need for the FD to save a copy of the
chosen ep descriptor.

> > This optimization is not full though. To fully exploit this
> > change one needs to update all the UDCs as well since in the current
> > implementation each of them saves the endpoint descriptor in it's
> > internal (and extended) endpoint structure.
>
> Do you do that optimization later on in this patch series?
>

No, we don't because we don't have the ability to test all the UDCs. Right
now the UDCs weren't modified and there is a code duplication. Meaning the
ep descriptor is saved both in the usb_ep structure and in the UDCs internal
ep structure. It's not very "clean" but nothing is broken.

> > +++ b/include/linux/usb/gadget.h
> > @@ -131,20 +131,22 @@ struct usb_ep_ops {
> > * @maxpacket:The maximum packet size used on this endpoint. The
> initial
> > * value can sometimes be reduced (hardware allowing), according to
> > * the endpoint descriptor used to configure the endpoint.
> > - * @driver_data:for use by the gadget driver. all other fields are
> > - * read-only to gadget drivers.
> > + * @driver_data:for use by the gadget driver.
>
> Why did you change the "all other fields..." portion?

Because the FD updates the usb_ep->desc field as well (with the value
returned from ep_choose()).

Sorry for the late response and the bad quoting (the email is a bit old). My
reply was delayed because our intention was to release the UT I mentioned
with the next version but unfortunately getting legal approval is taking
longer than we expected.

Best regards,
Tanya Brokhman
Consultant for Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum




--
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/