On Wednesday 15 April 2009, Matthias Kaehlcke wrote: > Use helper functions to determine the type and direction of an endpoint instead > of fiddling with bEndpointAddress and bmAttributes > > Signed-off-by: Matthias Kaehlcke <matthias@xxxxxxxxxxxx> This one I don't much like ... does it shrink the code? It only touched bmAttributes once before your changes, and afterwards it does so many times. > --- > drivers/usb/gadget/epautoconf.c | 28 +++++++++++----------------- > 1 files changed, 11 insertions(+), 17 deletions(-) > > diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c > index cd0914e..f56b4b0 100644 > --- a/drivers/usb/gadget/epautoconf.c > +++ b/drivers/usb/gadget/epautoconf.c > @@ -66,7 +66,6 @@ ep_matches ( > struct usb_endpoint_descriptor *desc > ) > { > - u8 type; > const char *tmp; > u16 max; > > @@ -75,8 +74,7 @@ ep_matches ( > return 0; > > /* only support ep0 for portable CONTROL traffic */ > - type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; You could have used usb_endpoint_type() there, and the win would have been clear. > - if (USB_ENDPOINT_XFER_CONTROL == type) > + if (usb_endpoint_xfer_control(desc)) ... instead of trusting the compiler to have good common subexpression elimination. > return 0; > > /* some other naming convention */ ... etc -- 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