All of lore.kernel.org
 help / color / mirror / Atom feed
From: Niklas Neronin <niklas.neronin@linux.intel.com>
To: mathias.nyman@linux.intel.com
Cc: linux-usb@vger.kernel.org,
	Niklas Neronin <niklas.neronin@linux.intel.com>
Subject: [PATCH 4/8] usb: xhci: improve xhci_clear_command_ring()
Date: Thu, 17 Oct 2024 16:05:04 +0300	[thread overview]
Message-ID: <20241017130508.1293021-5-niklas.neronin@linux.intel.com> (raw)
In-Reply-To: <20241017130508.1293021-1-niklas.neronin@linux.intel.com>

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 --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);
 	/*
-- 
2.45.2


  parent reply	other threads:[~2024-10-17 13:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 13:05 [PATCH 0/8] usb: xhci: various xhci cleanups and improvements Niklas Neronin
2024-10-17 13:05 ` [PATCH 1/8] usb: xhci: simplify TDs start and end naming scheme in struct 'xhci_td' Niklas Neronin
2024-10-17 21:59   ` Michał Pecio
2024-10-17 13:05 ` [PATCH 2/8] usb: xhci: move link TRB quirk to xhci_gen_setup() Niklas Neronin
2024-10-17 13:05 ` [PATCH 3/8] usb: xhci: request MSI/-X according to requested amount Niklas Neronin
2024-10-17 13:05 ` Niklas Neronin [this message]
2024-10-17 13:05 ` [PATCH 5/8] usb: xhci: remove unused arguments from td_to_noop() Niklas Neronin
2024-10-17 13:05 ` [PATCH 6/8] usb: xhci: refactor xhci_td_cleanup() to return void Niklas Neronin
2024-10-17 13:05 ` [PATCH 7/8] usb: xhci: add help function xhci_dequeue_td() Niklas Neronin
2024-10-17 13:05 ` [PATCH 8/8] usb: xhci: remove irrelevant comment Niklas Neronin
2024-10-30 14:35 ` [PATCH 0/8] usb: xhci: various xhci cleanups and improvements Mathias Nyman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241017130508.1293021-5-niklas.neronin@linux.intel.com \
    --to=niklas.neronin@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.