diff mbox series

[4/8] usb: xhci: improve xhci_clear_command_ring()

Message ID 20241017130508.1293021-5-niklas.neronin@linux.intel.com (mailing list archive)
State Accepted
Commit 36b972d4b7cef5d098de63fee8d00720c051f335
Headers show
Series usb: xhci: various xhci cleanups and improvements | expand

Commit Message

Niklas Neronin Oct. 17, 2024, 1:05 p.m. UTC
Remove redundant TRB cycle reset, the TRB cycle is already set to zero by
the preceding memset(), making the explicit reset unnecessary.

Clarify ring loop start point. Change the loop start from the dequeue
segment to the start segment. Both approaches achieve the same result,
but starting from the start segment makes it clearer that the entire ring
is being zeroed out.

Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
---
 drivers/usb/host/xhci.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 62c2fd301456..52c304329f26 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -778,10 +778,8 @@  static void xhci_clear_command_ring(struct xhci_hcd *xhci)
 	struct xhci_segment *seg;
 
 	ring = xhci->cmd_ring;
-	xhci_for_each_ring_seg(ring->deq_seg, seg) {
+	xhci_for_each_ring_seg(ring->first_seg, seg)
 		memset(seg->trbs, 0, sizeof(union xhci_trb) * (TRBS_PER_SEGMENT - 1));
-		seg->trbs[TRBS_PER_SEGMENT - 1].link.control &= cpu_to_le32(~TRB_CYCLE);
-	}
 
 	xhci_initialize_ring_info(ring);
 	/*