Re: [RFCv2 3/4] usb: gadget: epautoconf: check feature flags

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

 



Hi,

On Fri, Nov 08, 2013 at 02:24:43PM -0500, Alan Stern wrote:
> On Fri, 8 Nov 2013, Felipe Balbi wrote:
> 
> > Start matching endpoints against feature flags,
> > this will help us dropping the naming conventions
> > currently used by the Gadget Framework.
> 
> The logic doesn't look quite right.
> 
> > Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> > ---
> >  drivers/usb/gadget/epautoconf.c | 28 ++++++++++++++++++++++++++--
> >  1 file changed, 26 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
> > index feaaa7b..d55b5c4 100644
> > --- a/drivers/usb/gadget/epautoconf.c
> > +++ b/drivers/usb/gadget/epautoconf.c
> > @@ -62,6 +62,31 @@ ep_matches (
> >  	if (USB_ENDPOINT_XFER_CONTROL == type)
> >  		return 0;
> >  
> > +	/* first check feature flags */
> > +	if (ep->has_dir_in ^ usb_endpoint_dir_in(desc))
> > +		return 0;
> > +
> > +	if (ep->has_dir_out ^ usb_endpoint_dir_out(desc))
> > +		return 0;
> > +
> > +	switch (type) {
> > +	case USB_ENDPOINT_XFER_CONTROL:
> > +		/* only ep0 */
> > +		return 0;
> > +	case USB_ENDPOINT_XFER_BULK:
> > +		if (!ep->has_bulk)
> > +			return 0;
> > +		goto match;
> > +	case USB_ENDPOINT_XFER_INT:
> > +		if (!ep->has_interrupt)
> > +			return 0;
> > +		goto match;
> > +	case USB_ENDPOINT_XFER_ISOC:
> > +		if (!ep->has_isochronous)
> > +			return 0;
> > +		goto match;
> > +	}
> 
> How does the flow of control ever get to here?
> 
> I think what you want is more like this:
> 
> 	case USB_ENDPOINT_XFER_BULK:
> 		if (ep->has_bulk)
> 			goto match;
> 		break;
> 	etc...

true, we wouldn't ever check the legacy naming convention :-)

-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux