El Wed, Apr 15, 2009 at 02:14:50PM -0700 David Brownell ha dit: > On Wednesday 15 April 2009, Matthias Kaehlcke wrote: > > @@ -499,26 +499,24 @@ static int fsl_ep_enable(struct usb_ep *_ep, > > /* Init EPx Queue Head (Ep Capabilites field in QH > > * according to max, zlt, mult) */ > > struct_ep_qh_setup(udc, (unsigned char) ep_index(ep), > > - (unsigned char) ((desc->bEndpointAddress & USB_DIR_IN) > > - ? USB_SEND : USB_RECV), > > - (unsigned char) (desc->bmAttributes > > - & USB_ENDPOINT_XFERTYPE_MASK), > > + (unsigned char) (usb_endpoint_dir_in(desc) > > + ? USB_SEND : USB_RECV), > > + (unsigned char) (usb_endpoint_type(desc)), > > max, zlt, mult); > > Again, you broke the indentation. Here, by aligning to paren > instead of just using tabs ... > > > > > /* Init endpoint ctrl register */ > > dr_ep_setup((unsigned char) ep_index(ep), > > - (unsigned char) ((desc->bEndpointAddress & USB_DIR_IN) > > - ? USB_SEND : USB_RECV), > > - (unsigned char) (desc->bmAttributes > > - & USB_ENDPOINT_XFERTYPE_MASK)); > > + (unsigned char) (usb_endpoint_dir_in(desc) > > + ? USB_SEND : USB_RECV), > > + (unsigned char) (usb_endpoint_type(desc))); > > .... ditto ... > > > > > spin_unlock_irqrestore(&udc->lock, flags); > > retval = 0; > > > > VDBG("enabled %s (ep%d%s) maxpacket %d",ep->ep.name, > > - ep->desc->bEndpointAddress & 0x0f, > > - (desc->bEndpointAddress & USB_DIR_IN) > > - ? "in" : "out", max); > > + ep->desc->bEndpointAddress & 0x0f, > > + usb_endpoint_dir_in(desc) > > + ? "in" : "out", max); below a fixed version of the patch -- 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> --- drivers/usb/gadget/fsl_usb2_udc.c | 18 ++++++++---------- 1 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c index 9d7b95d..60e28c4 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.c +++ b/drivers/usb/gadget/fsl_usb2_udc.c @@ -468,7 +468,7 @@ static int fsl_ep_enable(struct usb_ep *_ep, zlt = 1; /* Assume the max packet size from gadget is always correct */ - switch (desc->bmAttributes & 0x03) { + switch (usb_endpoint_type(desc)) { case USB_ENDPOINT_XFER_CONTROL: case USB_ENDPOINT_XFER_BULK: case USB_ENDPOINT_XFER_INT: @@ -499,25 +499,23 @@ static int fsl_ep_enable(struct usb_ep *_ep, /* Init EPx Queue Head (Ep Capabilites field in QH * according to max, zlt, mult) */ struct_ep_qh_setup(udc, (unsigned char) ep_index(ep), - (unsigned char) ((desc->bEndpointAddress & USB_DIR_IN) + (unsigned char) (usb_endpoint_dir_in(desc) ? USB_SEND : USB_RECV), - (unsigned char) (desc->bmAttributes - & USB_ENDPOINT_XFERTYPE_MASK), + (unsigned char) (usb_endpoint_type(desc)), max, zlt, mult); /* Init endpoint ctrl register */ dr_ep_setup((unsigned char) ep_index(ep), - (unsigned char) ((desc->bEndpointAddress & USB_DIR_IN) + (unsigned char) (usb_endpoint_dir_in(desc) ? USB_SEND : USB_RECV), - (unsigned char) (desc->bmAttributes - & USB_ENDPOINT_XFERTYPE_MASK)); + (unsigned char) (usb_endpoint_type(desc))); spin_unlock_irqrestore(&udc->lock, flags); retval = 0; VDBG("enabled %s (ep%d%s) maxpacket %d",ep->ep.name, ep->desc->bEndpointAddress & 0x0f, - (desc->bEndpointAddress & USB_DIR_IN) + usb_endpoint_dir_in(desc) ? "in" : "out", max); en_done: return retval; @@ -776,7 +774,7 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) VDBG("%s, bad ep", __func__); return -EINVAL; } - if (ep->desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) { + if (usb_endpoint_xfer_isoc(ep->desc)) { if (req->req.length > ep->ep.maxpacket) return -EMSGSIZE; is_iso = 1; @@ -932,7 +930,7 @@ static int fsl_ep_set_halt(struct usb_ep *_ep, int value) goto out; } - if (ep->desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) { + if (usb_endpoint_xfer_isoc(ep->desc)) { status = -EOPNOTSUPP; goto out; } -- Matthias Kaehlcke Embedded Linux Engineer Barcelona You can't separate peace from freedom because no one can be at peace unless he has his freedom (Malcolm X) .''`. using free software / Debian GNU/Linux | http://debian.org : :' : `. `'` gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `- -- 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