Linux USB
 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 3/5] usb: xhci: remove redundant TT active EP update from xhci_free_virt_device()
Date: Tue,  6 Oct 2026 17:24:25 +0200	[thread overview]
Message-ID: <20261006152427.3735383-4-niklas.neronin@linux.intel.com> (raw)
In-Reply-To: <20261006152427.3735383-1-niklas.neronin@linux.intel.com>

Function xhci_free_virt_device() saves 'tt_info->active_eps' and later
calls xhci_update_tt_active_eps().

However, xhci_update_tt_active_eps() only updates TT accounting when the
number of active endpoints changes. xhci_free_virt_device() does not add
or remove endpoints and therefore leaves 'tt_info->active_eps' unchanged.
As a result, the call to xhci_update_tt_active_eps() never modifies any
state.

Remove the unused active endpoint tracking and the redundant call.

In cases where virtual devices are freed without first dropping their
endpoints, xhci_rh_bw_cleanup() resets all bandwidth accounting data,
making the update unnecessary.

Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
---
 drivers/usb/host/xhci-mem.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 75577f441cdd..d665cad22c10 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -870,7 +870,6 @@ void xhci_free_virt_device(struct xhci_hcd *xhci, struct xhci_virt_device *dev,
 		int slot_id)
 {
 	int i;
-	int old_active_eps = 0;
 
 	/* Slot ID 0 is reserved */
 	if (slot_id == 0 || !dev)
@@ -883,9 +882,6 @@ void xhci_free_virt_device(struct xhci_hcd *xhci, struct xhci_virt_device *dev,
 
 	trace_xhci_free_virt_device(dev);
 
-	if (dev->tt_info)
-		old_active_eps = dev->tt_info->active_eps;
-
 	for (i = 0; i < 31; i++) {
 		if (dev->eps[i].ring)
 			xhci_ring_free(xhci, dev->eps[i].ring);
@@ -908,8 +904,6 @@ void xhci_free_virt_device(struct xhci_hcd *xhci, struct xhci_virt_device *dev,
 	}
 	/* If this is a hub, free the TT(s) from the TT list */
 	xhci_free_tt_info(xhci, dev, slot_id);
-	/* If necessary, update the number of active TTs on this root port */
-	xhci_update_tt_active_eps(xhci, dev, old_active_eps);
 
 	if (dev->in_ctx)
 		xhci_free_container_ctx(xhci, dev->in_ctx);
-- 
2.50.1


  parent reply	other threads:[~2026-10-06 15:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 15:24 [PATCH 0/5] usb: xhci: bandwidth accounting fixes and cleanup Niklas Neronin
2026-10-06 15:24 ` [PATCH 1/5] usb: xhci: clear stale bandwidth data after hibernation Niklas Neronin
2026-10-06 16:12   ` Michal Pecio
2026-10-06 16:22   ` sashiko-bot
2026-10-06 15:24 ` [PATCH 2/5] usb: xhci: correct num_active_eps accounting on allocation failure Niklas Neronin
2026-10-06 16:29   ` sashiko-bot
2026-10-06 16:33   ` Michal Pecio
2026-10-06 21:02     ` Michal Pecio
2026-10-07  9:28       ` Neronin, Niklas
2026-10-06 15:24 ` Niklas Neronin [this message]
2026-10-06 16:41   ` [PATCH 3/5] usb: xhci: remove redundant TT active EP update from xhci_free_virt_device() sashiko-bot
2026-10-06 15:24 ` [PATCH 4/5] usb: xhci: correct variable size conversion Niklas Neronin
2026-10-06 16:46   ` sashiko-bot
2026-10-06 15:24 ` [PATCH 5/5] usb: xhci: remove unused structs Niklas Neronin
2026-10-06 16:47   ` sashiko-bot

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=20261006152427.3735383-4-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox