linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][for 4.14] xhci: allow TRACE to work with EVENT ring dequeue
@ 2017-09-22 17:20 Adam Wallis
  0 siblings, 0 replies; only message in thread
From: Adam Wallis @ 2017-09-22 17:20 UTC (permalink / raw)
  To: linux-arm-kernel

inc_deq() currently bails earlier for EVENT rings than the common return
point of the function, due to the fact that EVENT rings do not have
link TRBs. The unfortunate side effect of this is that the very useful
trace_xhci_inc_deq() function is not called/usable for EVENT ring
debug.

This patch provides a refactor by removing the multiple return exit
points into a single return which additionally allows for all rings to
use the trace function.

Signed-off-by: Adam Wallis <awallis@codeaurora.org>
---
 drivers/usb/host/xhci-ring.c | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index a944365..10afd50 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -171,25 +171,24 @@ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring)
 	if (ring->type == TYPE_EVENT) {
 		if (!last_trb_on_seg(ring->deq_seg, ring->dequeue)) {
 			ring->dequeue++;
-			return;
+		} else {
+			if (last_trb_on_ring(ring, ring->deq_seg,
+				ring->dequeue))
+				ring->cycle_state ^= 1;
+			ring->deq_seg = ring->deq_seg->next;
+			ring->dequeue = ring->deq_seg->trbs;
+		}
+	} else {
+		/* All other rings have link trbs */
+		if (!trb_is_link(ring->dequeue)) {
+			ring->dequeue++;
+			ring->num_trbs_free++;
+		}
+		while (trb_is_link(ring->dequeue)) {
+			ring->deq_seg = ring->deq_seg->next;
+			ring->dequeue = ring->deq_seg->trbs;
 		}
-		if (last_trb_on_ring(ring, ring->deq_seg, ring->dequeue))
-			ring->cycle_state ^= 1;
-		ring->deq_seg = ring->deq_seg->next;
-		ring->dequeue = ring->deq_seg->trbs;
-		return;
-	}
-
-	/* All other rings have link trbs */
-	if (!trb_is_link(ring->dequeue)) {
-		ring->dequeue++;
-		ring->num_trbs_free++;
-	}
-	while (trb_is_link(ring->dequeue)) {
-		ring->deq_seg = ring->deq_seg->next;
-		ring->dequeue = ring->deq_seg->trbs;
 	}
-
 	trace_xhci_inc_deq(ring);
 
 	return;
-- 
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-09-22 17:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-22 17:20 [PATCH][for 4.14] xhci: allow TRACE to work with EVENT ring dequeue Adam Wallis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).