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

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

 



Hi,

On Tue, Nov 26, 2013 at 11:57:21AM -0600, Felipe Balbi wrote:
> On Tue, Nov 26, 2013 at 12:56:04PM -0500, Alan Stern wrote:
> > On Tue, 26 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.
> > > 
> > > 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..3fe0d42 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;
> > 
> > I should have noticed this sooner (argh!).  The ^ operation isn't what
> > you want here -- if the endpoint hardware can work in either direction
> > then one of those two tests is bound to fail.  The code should be
> > structured more like the tests for the endpoint type, below.  In other 
> > words, like this:
> > 
> > 	if (usb_endpoint_dir_in(desc)) {
> > 		if (!ep->has_dir_in)
> > 			return 0;
> > 	} else {
> > 		if (!ep->has_dir_out)
> > 			return 0;
> > 	}
> 
> again, good point. /me should really review his own patches before
> sending them out.

fixed in my tree [1], will only resend if there are other comments.

[1] http://bit.ly/1aRAH9m

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