Re: [PATCH v5 2/3] usb: gadget: epautoconf: check feature flags

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

 



On 12/17/2013 02:23 AM, Felipe Balbi wrote:
> Start matching endpoints against feature flags,
> this will help us dropping the naming conventions
> currently used by the Gadget Framework.
> 
> Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> ---
>  drivers/usb/gadget/epautoconf.c | 30 ++++++++++++++++++++++++++++--
>  1 file changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
> index feaaa7b..b362046 100644
> --- a/drivers/usb/gadget/epautoconf.c
> +++ b/drivers/usb/gadget/epautoconf.c
> @@ -62,6 +62,33 @@ ep_matches (
>  	if (USB_ENDPOINT_XFER_CONTROL == type)
>  		return 0;
>  
> +	/* first check feature flags */
> +	if (usb_endpoint_dir_in(desc))
> +		if (!ep->has_dir_in)
> +			return 0;
> +
> +	if (usb_endpoint_dir_out(desc))
> +		if (!ep->has_dir_out)
> +			return 0;

You should add support for this flags in UDC drivers, or make it usable
for drivers which don't support this. Gadget drivers cannot bind to UDC
if its driver have not set this flags. Currently the only UDC driver
which has support for this is dwc3. It's a big issue.

> +
> +	switch (type) {
> +	case USB_ENDPOINT_XFER_CONTROL:
> +		/* only ep0 */
> +		return 0;
> +	case USB_ENDPOINT_XFER_BULK:
> +		if (ep->has_bulk)
> +			goto match;
> +		break;
> +	case USB_ENDPOINT_XFER_INT:
> +		if (ep->has_interrupt)
> +			goto match;
> +		break;
> +	case USB_ENDPOINT_XFER_ISOC:
> +		if (ep->has_isochronous)
> +			goto match;
> +		break;
> +	}
> +
>  	/* some other naming convention */
>  	if ('e' != ep->name[0])
>  		return 0;
> @@ -159,8 +186,7 @@ ep_matches (
>  		break;
>  	}
>  
> -	/* MATCH!! */
> -
> +match:
>  	/* report address */
>  	desc->bEndpointAddress &= USB_DIR_IN;
>  	if (isdigit (ep->name [2])) {
> 

Doing goto to this place you ignore maxpacket size check. It may cause
problems on handware with some maxpacket size limitations.

Best regards
Robert Baldyga
Samsung R&D Institute Poland
--
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