diff mbox series

[v3,4/4] xhci: Convert to use list_count()

Message ID 20221122153516.52577-4-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v3,1/4] i915: Move list_count() to list.h for broader use | expand

Commit Message

Andy Shevchenko Nov. 22, 2022, 3:35 p.m. UTC
The list API now provides the list_count() to help with counting
existing nodes in the list. Utilise it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v3: no change
v2: no change
 drivers/usb/host/xhci-ring.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Mathias Nyman Nov. 23, 2022, 2:30 p.m. UTC | #1
On 22.11.2022 17.35, Andy Shevchenko wrote:
> The list API now provides the list_count() to help with counting
> existing nodes in the list. Utilise it.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v3: no change
> v2: no change
>   drivers/usb/host/xhci-ring.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 

Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index ad81e9a508b1..817c31e3b0c8 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2532,7 +2532,6 @@  static int handle_tx_event(struct xhci_hcd *xhci,
 	union xhci_trb *ep_trb;
 	int status = -EINPROGRESS;
 	struct xhci_ep_ctx *ep_ctx;
-	struct list_head *tmp;
 	u32 trb_comp_code;
 	int td_num = 0;
 	bool handling_skipped_tds = false;
@@ -2580,10 +2579,8 @@  static int handle_tx_event(struct xhci_hcd *xhci,
 	}
 
 	/* Count current td numbers if ep->skip is set */
-	if (ep->skip) {
-		list_for_each(tmp, &ep_ring->td_list)
-			td_num++;
-	}
+	if (ep->skip)
+		td_num += list_count(&ep_ring->td_list);
 
 	/* Look for common error cases */
 	switch (trb_comp_code) {