lkml.org 
[lkml]   [2010]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC/PATCH v3 1/4] usb: Add usb_endpoint_descriptor to be part of the struct usb_ep
On Mon, 1 Nov 2010, 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. 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.
>
> Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>


> diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
> index a857b7a..edd8727 100644
> --- a/drivers/usb/gadget/file_storage.c
> +++ b/drivers/usb/gadget/file_storage.c
> @@ -2745,7 +2745,8 @@ static int enable_endpoint(struct fsg_dev *fsg, struct usb_ep *ep,
> int rc;
>
> ep->driver_data = fsg;
> - rc = usb_ep_enable(ep, d);
> + ep->desc = (struct usb_endpoint_descriptor *)d;
> + rc = usb_ep_enable(ep);
> if (rc)
> ERROR(fsg, "can't enable %s, result %d\n", ep->name, rc);
> return rc;

Instead of casting the variable, you should remove the "const"
qualifiers here and in the callers. After all, if usb_ep_enable is
going to change the descriptor then we shouldn't call it "const".

Alternatively, if usb_ep_enable _isn't_ going to change the descriptor
then perhaps the new pointer added to usb_ep should be declared
"const".

Alan Stern



\
 
 \ /
  Last update: 2010-11-01 20:55    [W:0.037 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site