[PATCH RFC 4/7] xHCI td_cnt supporting multi-TD

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

 



>From 5b9d7a87b2eddb87ebe691d6a83f94bd689551a2 Mon Sep 17 00:00:00 2001
From: Libin Yang <libin.yang@xxxxxxx>
Date: Fri, 26 Feb 2010 09:58:43 +0800
Subject: [PATCH 4/7] xHCI td_cnt supporting multi-TD

Using td_cnt to supporting multiple TDs transfer.
When there are multiple TDs in URB, all TDs need to be dealt
before URB transfer is completed.

Signed-off-by: Libin Yang <libin.yang@xxxxxxx>
---
 drivers/usb/host/xhci-hcd.c  |    1 +
 drivers/usb/host/xhci-ring.c |   14 +++++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci-hcd.c b/drivers/usb/host/xhci-hcd.c
index a708cf0..c318d5a 100644
--- a/drivers/usb/host/xhci-hcd.c
+++ b/drivers/usb/host/xhci-hcd.c
@@ -731,6 +731,7 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags)
 		goto exit;
 	}
 	urb_priv->length = size;
+	urb_priv->td_cnt = 0;
 	urb->hcpriv = urb_priv;
 
 	if (usb_endpoint_xfer_control(&urb->ep->desc)) {
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 6b0bd40..281284a 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1127,6 +1127,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
 	struct urb *urb = 0;
 	int status = -EINPROGRESS;
 	struct xhci_ep_ctx *ep_ctx;
+	struct urb_priv *urb_priv;
 	u32 trb_comp_code;
 
 	xhci_dbg(xhci, "In %s\n", __func__);
@@ -1325,9 +1326,13 @@ static int handle_tx_event(struct xhci_hcd *xhci,
 				if (usb_endpoint_xfer_bulk(&td->urb->ep->desc))
 					xhci_dbg(xhci, "Successful bulk "
 							"transfer!\n");
-				else
+				else if (usb_endpoint_xfer_int(
+						&td->urb->ep->desc))
 					xhci_dbg(xhci, "Successful interrupt "
 							"transfer!\n");
+				else
+					xhci_dbg(xhci, "Successful isoc "
+							"transfer!\n");
 				status = 0;
 			}
 			break;
@@ -1443,6 +1448,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
 td_cleanup:
 		/* Clean up the endpoint's TD list */
 		urb = td->urb;
+		urb_priv = urb->hcpriv;
+
 		/* Do one last check of the actual transfer length.
 		 * If the host controller said we transferred more data than
 		 * the buffer length, urb->actual_length will be a very big
@@ -1474,8 +1481,9 @@ td_cleanup:
 		if (usb_endpoint_xfer_control(&urb->ep->desc) ||
 			(trb_comp_code != COMP_STALL &&
 				trb_comp_code != COMP_BABBLE)) {
-			urb_free_priv(xhci, urb->hcpriv);
-			urb->hcpriv = NULL;
+			kfree(td);
+			urb_priv->td[urb_priv->td_cnt] = NULL;
+			urb_priv->td_cnt++;
 		}
 	}
 cleanup:
-- 
1.6.0.4




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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux