[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250604005919.4191884-71-sashal@kernel.org>
Date: Tue, 3 Jun 2025 20:58:57 -0400
From: Sasha Levin <sashal@...nel.org>
To: patches@...ts.linux.dev,
stable@...r.kernel.org
Cc: Kalesh AP <kalesh-anakkur.purayil@...adcom.com>,
Somnath Kotur <somnath.kotur@...adcom.com>,
Michael Chan <michael.chan@...adcom.com>,
Jakub Kicinski <kuba@...nel.org>,
Sasha Levin <sashal@...nel.org>,
pavan.chebbi@...adcom.com,
netdev@...r.kernel.org
Subject: [PATCH AUTOSEL 6.12 71/93] bnxt_en: Remove unused field "ref_count" in struct bnxt_ulp
From: Kalesh AP <kalesh-anakkur.purayil@...adcom.com>
[ Upstream commit 5bccacb4cc32cb835fe2fe100a210332c494e81d ]
The "ref_count" field in struct bnxt_ulp is unused after
commit a43c26fa2e6c ("RDMA/bnxt_re: Remove the sriov config callback").
So we can just remove it now.
Reviewed-by: Somnath Kotur <somnath.kotur@...adcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@...adcom.com>
Signed-off-by: Michael Chan <michael.chan@...adcom.com>
Link: https://patch.msgid.link/20250417172448.1206107-4-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
**YES** This commit should be backported to stable kernel trees.
**Analysis:** This commit removes an unused field `ref_count` from
`struct bnxt_ulp` and the associated code that was waiting for the
reference count to reach zero during unregistration. Looking at the code
changes: 1. **Removes unused field from struct definition**
(bnxt_ulp.h:49): The `atomic_t ref_count;` field is completely removed
from `struct bnxt_ulp`. 2. **Removes dead code** (bnxt_ulp.c:151-162):
The commit removes a loop that was waiting for
`atomic_read(&ulp->ref_count) != 0` with sleeps, which is now
unnecessary since the field and its usage were removed in a previous
commit (a43c26fa2e6c). **Why this should be backported:** 1. **Code
cleanup with no functional impact**: This is a pure cleanup commit that
removes truly unused code. The `ref_count` field was made unused by a
previous commit that removed the sriov config callback. 2. **Follows
stable backport patterns**: Looking at the similar commits, particularly
Similar Commit #1 which was marked "YES" for backport, this commit has
the exact same characteristics: - Removes unused functions/fields -
Small, contained change - No risk of regression - Code cleanup that
improves maintainability 3. **No architectural changes**: The commit
only removes code that was already dead/unused, with no changes to
active code paths. 4. **Minimal risk**: Since the code being removed was
already unused (as confirmed by the commit message referencing the
previous commit that made it unused), there's zero risk of regression.
5. **Clear precedent**: Similar Commit #1 showed that removal of unused
code (`bnxt_subtract_ulp_resources()` function and making
`bnxt_get_max_func_irqs()` static) was considered appropriate for
backporting. This commit fits the stable tree criteria perfectly: it's a
low-risk cleanup that removes dead code without affecting functionality,
similar to other cleanup commits that have been successfully backported.
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 5 -----
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 1 -
2 files changed, 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
index 546d9a3d7efea..b33c29fdf8fd3 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
@@ -148,7 +148,6 @@ void bnxt_unregister_dev(struct bnxt_en_dev *edev)
struct net_device *dev = edev->net;
struct bnxt *bp = netdev_priv(dev);
struct bnxt_ulp *ulp;
- int i = 0;
ulp = edev->ulp_tbl;
rtnl_lock();
@@ -164,10 +163,6 @@ void bnxt_unregister_dev(struct bnxt_en_dev *edev)
synchronize_rcu();
ulp->max_async_event_id = 0;
ulp->async_events_bmap = NULL;
- while (atomic_read(&ulp->ref_count) != 0 && i < 10) {
- msleep(100);
- i++;
- }
mutex_unlock(&edev->en_dev_lock);
rtnl_unlock();
return;
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h
index 4f4914f5c84c9..b76a231ca7dac 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h
@@ -48,7 +48,6 @@ struct bnxt_ulp {
unsigned long *async_events_bmap;
u16 max_async_event_id;
u16 msix_requested;
- atomic_t ref_count;
};
struct bnxt_en_dev {
--
2.39.5
Powered by blists - more mailing lists