diff options
author | Niklas Neronin <niklas.neronin@linux.intel.com> | 2024-11-06 12:14:52 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-11-06 13:26:15 +0100 |
commit | 36b972d4b7cef5d098de63fee8d00720c051f335 (patch) | |
tree | 8f3570f1a438dbaec49d71b9a5576a2f29622bdc | |
parent | 34fee04e7bdc4eb28385de31918fd74e57bb5dd2 (diff) | |
download | lwn-36b972d4b7cef5d098de63fee8d00720c051f335.tar.gz lwn-36b972d4b7cef5d098de63fee8d00720c051f335.zip |
usb: xhci: improve xhci_clear_command_ring()
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>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20241106101459.775897-27-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/host/xhci.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index e5719fd45a38..bc477cf99805 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); /* |