Re: [RFC/PATCH v3 1/4] usb: Add usb_endpoint_descriptor to be part of the struct usb_ep

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>


> 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

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux