Commit 9ab15651 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Greg Kroah-Hartman

USB: Goku-S: use helper functions to determine endpoint type and direction

Use helper functions to determine the type and direction of an endpoint
instead of fiddling with bEndpointAddress and bmAttributes
Signed-off-by: default avatarMatthias Kaehlcke <matthias@kaehlcke.net>
Acked-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 81c8d8d2
...@@ -110,10 +110,10 @@ goku_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) ...@@ -110,10 +110,10 @@ goku_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
return -EINVAL; return -EINVAL;
if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN)
return -ESHUTDOWN; return -ESHUTDOWN;
if (ep->num != (desc->bEndpointAddress & 0x0f)) if (ep->num != usb_endpoint_num(desc))
return -EINVAL; return -EINVAL;
switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) { switch (usb_endpoint_type(desc)) {
case USB_ENDPOINT_XFER_BULK: case USB_ENDPOINT_XFER_BULK:
case USB_ENDPOINT_XFER_INT: case USB_ENDPOINT_XFER_INT:
break; break;
...@@ -142,7 +142,7 @@ goku_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) ...@@ -142,7 +142,7 @@ goku_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
/* ep1/ep2 dma direction is chosen early; it works in the other /* ep1/ep2 dma direction is chosen early; it works in the other
* direction, with pio. be cautious with out-dma. * direction, with pio. be cautious with out-dma.
*/ */
ep->is_in = (USB_DIR_IN & desc->bEndpointAddress) != 0; ep->is_in = usb_endpoint_dir_in(desc);
if (ep->is_in) { if (ep->is_in) {
mode |= 1; mode |= 1;
ep->dma = (use_dma != 0) && (ep->num == UDC_MSTRD_ENDPOINT); ep->dma = (use_dma != 0) && (ep->num == UDC_MSTRD_ENDPOINT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment