summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Neronin <niklas.neronin@linux.intel.com>2024-02-29 16:14:33 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-03-02 20:25:27 +0100
commit00bdc4a34b2885f54468d4bdbb56d4055ce20ac9 (patch)
treefbc6a4ddc29066efe9413d36741ae72e3fd79af7
parent74151b5349266bd1a3a8307a05449a22bf0ba9de (diff)
downloadlinux-stable-00bdc4a34b2885f54468d4bdbb56d4055ce20ac9.tar.gz
linux-stable-00bdc4a34b2885f54468d4bdbb56d4055ce20ac9.tar.bz2
linux-stable-00bdc4a34b2885f54468d4bdbb56d4055ce20ac9.zip
usb: xhci: remove duplicate code from 'xhci_clear_command_ring()'
Replace a segment of code within 'xhci_clear_command_ring()' with a function call to 'xhci_initialize_ring_info()'. This change eliminates code duplication, as 'xhci_initialize_ring_info()' performs the same operations as the replaced code. 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/20240229141438.619372-5-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/xhci.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index c50d5881e214..5d70e0176527 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -794,19 +794,7 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci)
seg = seg->next;
} while (seg != ring->deq_seg);
- /* Reset the software enqueue and dequeue pointers */
- ring->deq_seg = ring->first_seg;
- ring->dequeue = ring->first_seg->trbs;
- ring->enq_seg = ring->deq_seg;
- ring->enqueue = ring->dequeue;
-
- ring->num_trbs_free = ring->num_segs * (TRBS_PER_SEGMENT - 1) - 1;
- /*
- * Ring is now zeroed, so the HW should look for change of ownership
- * when the cycle bit is set to 1.
- */
- ring->cycle_state = 1;
-
+ xhci_initialize_ring_info(ring, 1);
/*
* Reset the hardware dequeue pointer.
* Yes, this will need to be re-written after resume, but we're paranoid