This little helper is here for readability. It handles the details about how to cancel a TD due to an urb being dequeued. Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx> --- drivers/usb/host/xhci.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index a573c3a444ed..7d5f5cfd14eb 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1429,6 +1429,17 @@ static int xhci_maybe_stop_endpoint(struct xhci_hcd *xhci, return 0; } +static void xhci_cancel_td(struct xhci_virt_ep *ep, struct urb *urb) +{ + struct urb_priv *urb_priv = urb->hcpriv; + int i; + + for (i = urb_priv->num_tds_done; i < urb_priv->num_tds; i++) { + struct xhci_td *td = &urb_priv->td[i]; + list_add_tail(&td->cancelled_td_list, &ep->cancelled_td_list); + } +} + /* * Remove the URB's TD from the endpoint ring. This may cause the HC to stop * USB transfers, potentially stopping in the middle of a TRB buffer. The HC @@ -1467,12 +1478,10 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) struct urb_priv *urb_priv; struct xhci_virt_ep *ep; struct xhci_hcd *xhci; - struct xhci_td *td; unsigned long flags; unsigned int ep_index; u32 temp; int ret; - int i; xhci = hcd_to_xhci(hcd); spin_lock_irqsave(&xhci->lock, flags); @@ -1508,10 +1517,7 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) goto err_giveback; } - for (i = urb_priv->num_tds_done; i < urb_priv->num_tds; i++) { - td = &urb_priv->td[i]; - list_add_tail(&td->cancelled_td_list, &ep->cancelled_td_list); - } + xhci_cancel_td(ep, urb); ret = xhci_maybe_stop_endpoint(xhci, ep, urb, ep_index); done: -- 2.16.1 -- 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