Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH mt76 2/4] wifi: mt76: mt7996: Fix deflink lookup removing links
From: Lorenzo Bianconi @ 2026-03-06 10:27 UTC (permalink / raw)
  To: Felix Fietkau, Ryder Lee, Shayne Chen, Sean Wang,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: linux-wireless, linux-arm-kernel, linux-mediatek,
	Lorenzo Bianconi
In-Reply-To: <20260306-mt7996-deflink-lookup-link-remove-v1-0-7162b332873c@kernel.org>

Do not set vif deflink in mt7996_vif_link_remove routine if the vif txq
pointer is NULL in order to not miss the mtxq wcid field update adding
a new link with a valid vif txq pointer.

Fixes: 2e6bdd40e1d01 ("wifi: mt76: mt7996: Reset mtxq->idx if primary link is removed in mt7996_vif_link_remove()")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7996/main.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index 8b1924778cbd6a5f6a516a689a379fb715cc3097..e76643b8234b6323fa53f1f5958e23b5adc99c72 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -405,26 +405,26 @@ void mt7996_vif_link_remove(struct mt76_phy *mphy, struct ieee80211_vif *vif,
 
 	rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
 
-	if (!mlink->wcid->offchannel &&
+	if (vif->txq && !mlink->wcid->offchannel &&
 	    mvif->mt76.deflink_id == link_conf->link_id) {
 		struct ieee80211_bss_conf *iter;
+		struct mt76_txq *mtxq;
 		unsigned int link_id;
 
-		/* Primary link will be removed, look for a new one */
 		mvif->mt76.deflink_id = IEEE80211_LINK_UNSPECIFIED;
+		mtxq = (struct mt76_txq *)vif->txq->drv_priv;
+		/* Primary link will be removed, look for a new one */
 		for_each_vif_active_link(vif, iter, link_id) {
 			struct mt7996_vif_link *link;
 
+			if (link_id == link_conf->link_id)
+				continue;
+
 			link = mt7996_vif_link(dev, vif, link_id);
 			if (!link)
 				continue;
 
-			if (vif->txq) {
-				struct mt76_txq *mtxq;
-
-				mtxq = (struct mt76_txq *)vif->txq->drv_priv;
-				mtxq->wcid = link->msta_link.wcid.idx;
-			}
+			mtxq->wcid = link->msta_link.wcid.idx;
 			mvif->mt76.deflink_id = link_id;
 			break;
 		}

-- 
2.53.0


^ permalink raw reply related

* [PATCH mt76 1/4] wifi: mt76: mt7996: Remove link pointer dependency in mt7996_mac_sta_remove_links()
From: Lorenzo Bianconi @ 2026-03-06 10:27 UTC (permalink / raw)
  To: Felix Fietkau, Ryder Lee, Shayne Chen, Sean Wang,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: linux-wireless, linux-arm-kernel, linux-mediatek,
	Lorenzo Bianconi
In-Reply-To: <20260306-mt7996-deflink-lookup-link-remove-v1-0-7162b332873c@kernel.org>

Remove link pointer dependency in mt7996_mac_sta_remove_links routine to
get the mt7996_phy pointer since the link can be already offchannel
running mt7996_mac_sta_remove_links(). Rely on __mt7996_phy routine
instead.

Fixes: 344dd6a4c919 ("wifi: mt76: mt7996: Move num_sta accounting in mt7996_mac_sta_{add,remove}_links")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7996/main.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index e1e51c9a0767be5a15dae48d627fb45b6f12af21..8b1924778cbd6a5f6a516a689a379fb715cc3097 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -1100,8 +1100,7 @@ mt7996_mac_sta_remove_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
 
 	for_each_set_bit(link_id, &links, IEEE80211_MLD_MAX_NUM_LINKS) {
 		struct mt7996_sta_link *msta_link = NULL;
-		struct mt7996_vif_link *link;
-		struct mt76_phy *mphy;
+		struct mt7996_phy *phy;
 
 		msta_link = rcu_replace_pointer(msta->link[link_id], msta_link,
 						lockdep_is_held(&mdev->mutex));
@@ -1110,17 +1109,12 @@ mt7996_mac_sta_remove_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
 
 		mt7996_mac_wtbl_update(dev, msta_link->wcid.idx,
 				       MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
-
 		mt7996_mac_sta_deinit_link(dev, msta_link);
-		link = mt7996_vif_link(dev, vif, link_id);
-		if (!link)
-			continue;
 
-		mphy = mt76_vif_link_phy(&link->mt76);
-		if (!mphy)
-			continue;
+		phy = __mt7996_phy(dev, msta_link->wcid.phy_idx);
+		if (phy)
+			phy->mt76->num_sta--;
 
-		mphy->num_sta--;
 		if (msta->deflink_id == link_id) {
 			if (msta->seclink_id == msta->deflink_id) {
 				/* no secondary link available */

-- 
2.53.0


^ permalink raw reply related

* [PATCH mt76 0/4] wifi: mt76: mt7996: Some MLO link reconfiguration fixes
From: Lorenzo Bianconi @ 2026-03-06 10:27 UTC (permalink / raw)
  To: Felix Fietkau, Ryder Lee, Shayne Chen, Sean Wang,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: linux-wireless, linux-arm-kernel, linux-mediatek,
	Lorenzo Bianconi

This is a preliminary series to properly support R1 link reconfiguration
on AP side.

---
Lorenzo Bianconi (4):
      wifi: mt76: mt7996: Remove link pointer dependency in mt7996_mac_sta_remove_links()
      wifi: mt76: mt7996: Fix deflink lookup removing links
      wifi: mt76: mt7996: Fix deflink lookup adding links
      wifi: mt76: mt7996: Remove unnecessary phy filed in mt7996_vif_link struct

 .../net/wireless/mediatek/mt76/mt7996/debugfs.c    | 14 +++-
 drivers/net/wireless/mediatek/mt76/mt7996/mac.c    |  7 +-
 drivers/net/wireless/mediatek/mt76/mt7996/main.c   | 82 ++++++++++++----------
 drivers/net/wireless/mediatek/mt76/mt7996/mcu.c    | 74 +++++++++++++------
 drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h |  2 -
 5 files changed, 116 insertions(+), 63 deletions(-)
---
base-commit: 030eea77accf40477be540445fc5a5be52d810a3
change-id: 20260304-mt7996-deflink-lookup-link-remove-1cdd0e43de81

Best regards,
-- 
Lorenzo Bianconi <lorenzo@kernel.org>


^ permalink raw reply

* Re: [PATCH 00/13] wifi: drop redundant USB device references
From: Greg Kroah-Hartman @ 2026-03-06  9:49 UTC (permalink / raw)
  To: Ping-Ke Shih
  Cc: Johan Hovold, linux-wireless@vger.kernel.org, Brian Norris,
	Francesco Dolcini, Felix Fietkau, Lorenzo Bianconi, Ryder Lee,
	Shayne Chen, Sean Wang, Jakub Kicinski, Stanislaw Gruszka,
	Hin-Tak Leung, Jes Sorensen, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Matthias Brugger, AngeloGioacchino Del Regno,
	libertas-dev@lists.infradead.org, linux-kernel@vger.kernel.org
In-Reply-To: <81935da1c67a493c8313d906244dd577@realtek.com>

On Fri, Mar 06, 2026 at 09:04:22AM +0000, Ping-Ke Shih wrote:
> Johan Hovold <johan@kernel.org> wrote:
> > On Fri, Mar 06, 2026 at 01:40:31AM +0000, Ping-Ke Shih wrote:
> > > // +Cc Greg
> > >
> > > Hi Johan,
> > >
> > > Johan Hovold <johan@kernel.org> wrote:
> > >
> > > [...]
> > >
> > > >  drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c |  4 ----
> > > >  drivers/net/wireless/realtek/rtl8xxxu/core.c       | 11 +++--------
> > > >  drivers/net/wireless/realtek/rtlwifi/usb.c         |  4 ----
> > >
> > > Acked to changes of these Realtek WiFi drivers. But I'd like to know why
> > > rtw88/rtw89 aren't included in this patchset?
> > 
> > I used a more specific grep pattern to catch driver releasing references
> > in disconnect() and therefore missed a few that dropped the reference in
> > helper functions (or used non-standard names for their disconnect
> > function such as ath10k, I see now).
> > 
> > > Greg sent a patch [1] to
> > > correct error path of USB probe for rtw88. In the discussion, he also
> > > mentioned the simplest way is to drop usb_get_dev()/usb_put_dev() like
> > > this patchset does. Will you share patches for rtw88/rtw89? I so, I'd
> > > drop Greg's patch and apply yours.
> > >
> > > [1] https://lore.kernel.org/linux-wireless/2026022333-periscope-unusual-f0a0@gregkh/
> > 
> > Sure, I can include rtw88 (and ath10k and ath6kl) in a v2.
> 
> Can you please also include rtw89? (I saw you have sent v2 though)
> 
> > 
> > Do you really prefer replacing Greg's fix or shall I send an incremental
> > patch on top?
> 
> No. I'd drop Gerg's fix from my tree.

I have no objection for my changes being dropped, thanks for making
these changes.

greg k-h

^ permalink raw reply

* Re: [PATCH 04/13] wifi: mwifiex: drop redundant device reference
From: Francesco Dolcini @ 2026-03-06  9:46 UTC (permalink / raw)
  To: Johan Hovold
  Cc: linux-wireless, Brian Norris, Francesco Dolcini, Felix Fietkau,
	Lorenzo Bianconi, Ryder Lee, Shayne Chen, Sean Wang,
	Jakub Kicinski, Stanislaw Gruszka, Hin-Tak Leung, Jes Sorensen,
	Ping-Ke Shih, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	Matthias Brugger, AngeloGioacchino Del Regno, libertas-dev,
	linux-kernel
In-Reply-To: <20260305110713.17725-5-johan@kernel.org>

On Thu, Mar 05, 2026 at 12:07:04PM +0100, Johan Hovold wrote:
> Driver core holds a reference to the USB interface and its parent USB
> device while the interface is bound to a driver and there is no need to
> take additional references unless the structures are needed after
> disconnect.
> 
> Drop the redundant device reference to reduce cargo culting, make it
> easier to spot drivers where an extra reference is needed, and reduce
> the risk of memory leaks when drivers fail to release it.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>

Acked-by: Francesco Dolcini <francesco.dolcini@toradex.com>


^ permalink raw reply

* RE: [PATCH 00/13] wifi: drop redundant USB device references
From: Ping-Ke Shih @ 2026-03-06  9:36 UTC (permalink / raw)
  To: Johan Hovold
  Cc: linux-wireless@vger.kernel.org, Brian Norris, Francesco Dolcini,
	Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
	Sean Wang, Jakub Kicinski, Stanislaw Gruszka, Hin-Tak Leung,
	Jes Sorensen, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	Matthias Brugger, AngeloGioacchino Del Regno,
	libertas-dev@lists.infradead.org, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman
In-Reply-To: <aaqfwRTJVswShHSW@hovoldconsulting.com>

Johan Hovold <johan@kernel.org> wrote:
> On Fri, Mar 06, 2026 at 09:04:22AM +0000, Ping-Ke Shih wrote:
> > Johan Hovold <johan@kernel.org> wrote:
> 
> > > Sure, I can include rtw88 (and ath10k and ath6kl) in a v2.
> >
> > Can you please also include rtw89? (I saw you have sent v2 though)
> 
> Ah, sorry about that. I was sure I had grepped for usb_get_dev in
> wireless before sending v2 but apparently I did not.
> 
> I just sent a separate follow-up for rtw89 here:
> 
>         https://lore.kernel.org/r/20260306093206.21081-1-johan@kernel.org

Got it & thank you. :)

Ping-Ke


^ permalink raw reply

* Re: [PATCH 00/13] wifi: drop redundant USB device references
From: Johan Hovold @ 2026-03-06  9:34 UTC (permalink / raw)
  To: Ping-Ke Shih
  Cc: linux-wireless@vger.kernel.org, Brian Norris, Francesco Dolcini,
	Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
	Sean Wang, Jakub Kicinski, Stanislaw Gruszka, Hin-Tak Leung,
	Jes Sorensen, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	Matthias Brugger, AngeloGioacchino Del Regno,
	libertas-dev@lists.infradead.org, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman
In-Reply-To: <81935da1c67a493c8313d906244dd577@realtek.com>

On Fri, Mar 06, 2026 at 09:04:22AM +0000, Ping-Ke Shih wrote:
> Johan Hovold <johan@kernel.org> wrote:

> > Sure, I can include rtw88 (and ath10k and ath6kl) in a v2.
> 
> Can you please also include rtw89? (I saw you have sent v2 though)

Ah, sorry about that. I was sure I had grepped for usb_get_dev in
wireless before sending v2 but apparently I did not.

I just sent a separate follow-up for rtw89 here:

	https://lore.kernel.org/r/20260306093206.21081-1-johan@kernel.org

Johan

^ permalink raw reply

* [PATCH] wifi: rtw89: drop redundant device reference
From: Johan Hovold @ 2026-03-06  9:32 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ping-Ke Shih, linux-kernel, Johan Hovold

Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.

Signed-off-by: Johan Hovold <johan@kernel.org>
---

Here's a follow-up to 

	https://lore.kernel.org/all/20260306085144.12064-1-johan@kernel.org/

which failed to include rtw89 despite Ping-Ke's explicit request (I
thought I had grepped for usb_get_dev in wireless before sending out
that series, but apparently not).

Johan


 drivers/net/wireless/realtek/rtw89/usb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/usb.c b/drivers/net/wireless/realtek/rtw89/usb.c
index da1b7ce8089e..64f0c0ec5ed4 100644
--- a/drivers/net/wireless/realtek/rtw89/usb.c
+++ b/drivers/net/wireless/realtek/rtw89/usb.c
@@ -935,7 +935,7 @@ static int rtw89_usb_intf_init(struct rtw89_dev *rtwdev,
 	if (!rtwusb->vendor_req_buf)
 		return -ENOMEM;
 
-	rtwusb->udev = usb_get_dev(interface_to_usbdev(intf));
+	rtwusb->udev = interface_to_usbdev(intf);
 
 	usb_set_intfdata(intf, rtwdev->hw);
 
@@ -949,7 +949,6 @@ static void rtw89_usb_intf_deinit(struct rtw89_dev *rtwdev,
 {
 	struct rtw89_usb *rtwusb = rtw89_usb_priv(rtwdev);
 
-	usb_put_dev(rtwusb->udev);
 	kfree(rtwusb->vendor_req_buf);
 	usb_set_intfdata(intf, NULL);
 }
-- 
2.52.0


^ permalink raw reply related

* Re: [PATCH v10 00/21] wifi: nxpwifi: create nxpwifi to support
From: Johannes Berg @ 2026-03-06  9:19 UTC (permalink / raw)
  To: Jeff Chen, linux-wireless; +Cc: linux-kernel, francesco, wyatt.hsu, s.hauer
In-Reply-To: <20260305143939.3724868-1-jeff.chen_1@nxp.com>

On Thu, 2026-03-05 at 22:39 +0800, Jeff Chen wrote:
> This series adds a new full-MAC Wi-Fi driver `nxpwifi` to support NXP
> IW611/IW612 chip family. These chips are tri-radio single-chip solutions
> with Wi-Fi 6(1x1, 2.4/5 GHz), Bluetooth 5.4, and IEEE 802.15.4.
> Communication with the external host is via SDIO interface. The driver is
> tested on i.MX8M Mini EVK in both STA and AP mode.

How exactly was it tested, it doesn't even build ;-)

There are a couple of things I'm not a huge fan of, in particular the
whole "IOCTL" layer which is reminiscent of wireless extensions (but
thankfully those aren't used here), and while I can't really review 35k
lines here, I don't think I have any real problem with this now.

As I also just said to Lachlan, I think you should probably send a pull
request with just a single patch adding the driver once reviews settle.

https://lore.kernel.org/linux-wireless/b71d0932b10b5c446681cef588cfcf6f869f3fca.camel@sipsolutions.net/

johannes

^ permalink raw reply

* Re: [PATCH wireless-next 26/35] wifi: mm81x: add usb.c
From: Johannes Berg @ 2026-03-06  9:11 UTC (permalink / raw)
  To: Lachlan Hodges, Dan Callaghan, Arien Judge
  Cc: ayman.grais, linux-wireless, linux-kernel
In-Reply-To: <20260227041108.66508-27-lachlan.hodges@morsemicro.com>

On Fri, 2026-02-27 at 15:10 +1100, Lachlan Hodges wrote:
> 
> +/*
> + * See https://www.kernel.org/doc/html/v5.15/driver-api/usb/error-codes.html

Seems a bit odd to refer to an ancient version on the web rather than
just Documentation/driver-api/usb/error-codes.rst?

johannes

^ permalink raw reply

* Re: [PATCH wireless-next 18/35] wifi: mm81x: add ps.c
From: Johannes Berg @ 2026-03-06  9:07 UTC (permalink / raw)
  To: Lachlan Hodges, Dan Callaghan, Arien Judge
  Cc: ayman.grais, linux-wireless, linux-kernel
In-Reply-To: <20260227041108.66508-19-lachlan.hodges@morsemicro.com>

On Fri, 2026-02-27 at 15:10 +1100, Lachlan Hodges wrote:
> 
> +	return (gpiod_get_value_cansleep(mm->ps.busy_gpio) == active_high);

I thought something (checkpatch?) used to warn on "return as a function"
:)

johannes

^ permalink raw reply

* RE: [PATCH 00/13] wifi: drop redundant USB device references
From: Ping-Ke Shih @ 2026-03-06  9:04 UTC (permalink / raw)
  To: Johan Hovold
  Cc: linux-wireless@vger.kernel.org, Brian Norris, Francesco Dolcini,
	Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
	Sean Wang, Jakub Kicinski, Stanislaw Gruszka, Hin-Tak Leung,
	Jes Sorensen, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	Matthias Brugger, AngeloGioacchino Del Regno,
	libertas-dev@lists.infradead.org, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman
In-Reply-To: <aaqL0RdwEjWWjECk@hovoldconsulting.com>

Johan Hovold <johan@kernel.org> wrote:
> On Fri, Mar 06, 2026 at 01:40:31AM +0000, Ping-Ke Shih wrote:
> > // +Cc Greg
> >
> > Hi Johan,
> >
> > Johan Hovold <johan@kernel.org> wrote:
> >
> > [...]
> >
> > >  drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c |  4 ----
> > >  drivers/net/wireless/realtek/rtl8xxxu/core.c       | 11 +++--------
> > >  drivers/net/wireless/realtek/rtlwifi/usb.c         |  4 ----
> >
> > Acked to changes of these Realtek WiFi drivers. But I'd like to know why
> > rtw88/rtw89 aren't included in this patchset?
> 
> I used a more specific grep pattern to catch driver releasing references
> in disconnect() and therefore missed a few that dropped the reference in
> helper functions (or used non-standard names for their disconnect
> function such as ath10k, I see now).
> 
> > Greg sent a patch [1] to
> > correct error path of USB probe for rtw88. In the discussion, he also
> > mentioned the simplest way is to drop usb_get_dev()/usb_put_dev() like
> > this patchset does. Will you share patches for rtw88/rtw89? I so, I'd
> > drop Greg's patch and apply yours.
> >
> > [1] https://lore.kernel.org/linux-wireless/2026022333-periscope-unusual-f0a0@gregkh/
> 
> Sure, I can include rtw88 (and ath10k and ath6kl) in a v2.

Can you please also include rtw89? (I saw you have sent v2 though)

> 
> Do you really prefer replacing Greg's fix or shall I send an incremental
> patch on top?

No. I'd drop Gerg's fix from my tree.

Ping-Ke


^ permalink raw reply

* Re: [PATCH wireless-next 17/35] wifi: mm81x: add mmrc.h
From: Johannes Berg @ 2026-03-06  9:07 UTC (permalink / raw)
  To: Lachlan Hodges, Dan Callaghan, Arien Judge
  Cc: ayman.grais, linux-wireless, linux-kernel
In-Reply-To: <20260227041108.66508-18-lachlan.hodges@morsemicro.com>

On Fri, 2026-02-27 at 15:10 +1100, Lachlan Hodges wrote:
> 
> +#define BIT_COUNT(_x) (hweight_long(_x))

Is that really worth having?

> +/* Used to spehify supported features when initialising a STA */
> +#define MMRC_MASK(x) (1u << (x))

typo, but is that even better than BIT()?

> +struct mmrc_sta_capabilities {
> +	u8 max_rates : 3;
> +	u8 max_retries : 3;
> +	u8 bandwidth : 5;
> +	u8 spatial_streams : 4;
> +	u16 rates : 11;
> +	u8 guard : 2;
> +	u8 sta_flags : 4;
> +	u8 sgi_per_bw : 5;

I think this packs better if you use a bigger type?

johannes

^ permalink raw reply

* Re: [PATCH wireless-next 14/35] wifi: mm81x: add mac.c
From: Johannes Berg @ 2026-03-06  9:04 UTC (permalink / raw)
  To: Lachlan Hodges, Dan Callaghan, Arien Judge, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt
  Cc: ayman.grais, linux-wireless, linux-kernel
In-Reply-To: <20260227041108.66508-15-lachlan.hodges@morsemicro.com>

On Fri, 2026-02-27 at 15:10 +1100, Lachlan Hodges wrote:
> 
> +static int mm81x_mac_ops_hw_scan(struct ieee80211_hw *hw,
> +				 struct ieee80211_vif *vif,
> +				 struct ieee80211_scan_request *hw_req)
> +{
> +	int ret = 0;
> +	struct mm81x *mm = hw->priv;
> +	struct cfg80211_scan_request *req = &hw_req->req;
> +	struct mm81x_hw_scan_params *params;
> +	struct ieee80211_channel **chans = hw_req->req.channels;
> +

> +	mutex_lock(&mm->lock);

Seeing this, I wonder about two things:

 1) Do you even need a mutex, given that the wiphy mutex covers all of
    this pretty much? I can say from experience that a _lot_ of things
    get quite significantly simpler without a separate driver mutex.

 2) Are you going to incur the wrath of mm/ folks, where instances of
    'struct mm_struct' are commonly called 'mm'? I can find a few
    examples of others (struct drm_buddy *mm, struct mqd_manager *mm),
    but you'd double the instances.

> +	UNUSED(hw);
> +	UNUSED(ctx);

I think you should remove these (and the macro.)

> +	/*
> +	 * mm81x only support changing/setting the channel
> +	 * when we create an interface.
> +	 */
> +	if (WARN_ON(changed & IEEE80211_CHANCTX_CHANGE_CHANNEL))
> +		mm81x_err(mm, "Changing channel via chanctx not supported");

Wait, what, why do you have chanctx support then? This seems highly
questionable, how do you not run into this all the time?

If it just has a single, wouldn't the chanctx emulation suit the driver
better, and that'd make this more obvious? Hmm, but you _do_ support
multiple vifs? I'm confused.

> +static int mm81x_mac_ops_sta_state(struct ieee80211_hw *hw,
> +				   struct ieee80211_vif *vif,
> +				   struct ieee80211_sta *sta,
> +				   enum ieee80211_sta_state old_state,
> +				   enum ieee80211_sta_state new_state)
> +{
> +	u16 aid;
> +	int ret = 0;

nit: that =0 assignment is unused. I (we?) tend to not add them so the
compiler can warn if the remaining code changes.

> +		WARN_ON((key->flags & IEEE80211_KEY_FLAG_PAIRWISE));

nit: extra parentheses

> + * The firmware passes up NULL vifs for broadcast management frames. Find
> + * the first interface that best fits the frame we are rx'ing. This
> + * has the clear downside if we have two vifs with the same interface type
> + * the 2nd vif will never be targeted. For now, this will have to do.

Why do you need this? Curious, because mac80211 ought to sort out the
right vif (or even send it to multiple) anyway?

The only user _appears_ to be mm81x_rx_h_update_sta() which seems you
could just skip entirely for broadcast mgmt frames, since it's just
statistics?
Or look up the STA not the VIF (ieee80211_find_sta_by_ifaddr() can take
a NULL ifaddr)?

Anyway, not really important.

> +	ieee80211_rx_irqsafe(hw, skb);

This seems a bit pointless, you're coming from a worker already, so why
jump through a tasklet again? Seems ieee80211_rx() would do, unless you
have some assumptions on how fast the work must process? (but then you
should probably document those.)

(I'm not going to look in this much detail at the other stuff, this just
because of the mac80211 interface.)

johannes


^ permalink raw reply

* [PATCH v2 01/18] wifi: ath6kl: drop redundant device reference
From: Johan Hovold @ 2026-03-06  8:51 UTC (permalink / raw)
  To: linux-wireless
  Cc: Jeff Johnson, Toke Høiland-Jørgensen, Brian Norris,
	Francesco Dolcini, Felix Fietkau, Lorenzo Bianconi, Ryder Lee,
	Shayne Chen, Sean Wang, Jakub Kicinski, Stanislaw Gruszka,
	Hin-Tak Leung, Jes Sorensen, Ping-Ke Shih, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Matthias Brugger,
	AngeloGioacchino Del Regno, Greg Kroah-Hartman, libertas-dev,
	linux-kernel, Johan Hovold
In-Reply-To: <20260306085144.12064-1-johan@kernel.org>

Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/net/wireless/ath/ath6kl/usb.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c
index 852e77e41bde..814faf96f1ff 100644
--- a/drivers/net/wireless/ath/ath6kl/usb.c
+++ b/drivers/net/wireless/ath/ath6kl/usb.c
@@ -1124,8 +1124,6 @@ static int ath6kl_usb_probe(struct usb_interface *interface,
 	int vendor_id, product_id;
 	int ret = 0;
 
-	usb_get_dev(dev);
-
 	vendor_id = le16_to_cpu(dev->descriptor.idVendor);
 	product_id = le16_to_cpu(dev->descriptor.idProduct);
 
@@ -1143,11 +1141,8 @@ static int ath6kl_usb_probe(struct usb_interface *interface,
 		ath6kl_dbg(ATH6KL_DBG_USB, "USB 1.1 Host\n");
 
 	ar_usb = ath6kl_usb_create(interface);
-
-	if (ar_usb == NULL) {
-		ret = -ENOMEM;
-		goto err_usb_put;
-	}
+	if (ar_usb == NULL)
+		return -ENOMEM;
 
 	ar = ath6kl_core_create(&ar_usb->udev->dev);
 	if (ar == NULL) {
@@ -1176,15 +1171,12 @@ static int ath6kl_usb_probe(struct usb_interface *interface,
 	ath6kl_core_destroy(ar);
 err_usb_destroy:
 	ath6kl_usb_destroy(ar_usb);
-err_usb_put:
-	usb_put_dev(dev);
 
 	return ret;
 }
 
 static void ath6kl_usb_remove(struct usb_interface *interface)
 {
-	usb_put_dev(interface_to_usbdev(interface));
 	ath6kl_usb_device_detached(interface);
 }
 
-- 
2.52.0


^ permalink raw reply related

* [PATCH v2 04/18] wifi: ath10k: drop redundant device reference
From: Johan Hovold @ 2026-03-06  8:51 UTC (permalink / raw)
  To: linux-wireless
  Cc: Jeff Johnson, Toke Høiland-Jørgensen, Brian Norris,
	Francesco Dolcini, Felix Fietkau, Lorenzo Bianconi, Ryder Lee,
	Shayne Chen, Sean Wang, Jakub Kicinski, Stanislaw Gruszka,
	Hin-Tak Leung, Jes Sorensen, Ping-Ke Shih, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Matthias Brugger,
	AngeloGioacchino Del Regno, Greg Kroah-Hartman, libertas-dev,
	linux-kernel, Johan Hovold
In-Reply-To: <20260306085144.12064-1-johan@kernel.org>

Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/net/wireless/ath/ath10k/usb.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/usb.c b/drivers/net/wireless/ath/ath10k/usb.c
index 6661fff326e0..ad1cf0681b19 100644
--- a/drivers/net/wireless/ath/ath10k/usb.c
+++ b/drivers/net/wireless/ath/ath10k/usb.c
@@ -1016,7 +1016,6 @@ static int ath10k_usb_probe(struct usb_interface *interface,
 
 	netif_napi_add(ar->napi_dev, &ar->napi, ath10k_usb_napi_poll);
 
-	usb_get_dev(dev);
 	vendor_id = le16_to_cpu(dev->descriptor.idVendor);
 	product_id = le16_to_cpu(dev->descriptor.idProduct);
 
@@ -1055,8 +1054,6 @@ static int ath10k_usb_probe(struct usb_interface *interface,
 err:
 	ath10k_core_destroy(ar);
 
-	usb_put_dev(dev);
-
 	return ret;
 }
 
@@ -1071,7 +1068,6 @@ static void ath10k_usb_remove(struct usb_interface *interface)
 	ath10k_core_unregister(ar_usb->ar);
 	netif_napi_del(&ar_usb->ar->napi);
 	ath10k_usb_destroy(ar_usb->ar);
-	usb_put_dev(interface_to_usbdev(interface));
 	ath10k_core_destroy(ar_usb->ar);
 }
 
-- 
2.52.0


^ permalink raw reply related

* [PATCH v2 16/18] wifi: rtl818x: drop redundant device reference
From: Johan Hovold @ 2026-03-06  8:51 UTC (permalink / raw)
  To: linux-wireless
  Cc: Jeff Johnson, Toke Høiland-Jørgensen, Brian Norris,
	Francesco Dolcini, Felix Fietkau, Lorenzo Bianconi, Ryder Lee,
	Shayne Chen, Sean Wang, Jakub Kicinski, Stanislaw Gruszka,
	Hin-Tak Leung, Jes Sorensen, Ping-Ke Shih, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Matthias Brugger,
	AngeloGioacchino Del Regno, Greg Kroah-Hartman, libertas-dev,
	linux-kernel, Johan Hovold
In-Reply-To: <20260306085144.12064-1-johan@kernel.org>

Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c
index f7e0f6573180..1d21c468a236 100644
--- a/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c
+++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c
@@ -1475,8 +1475,6 @@ static int rtl8187_probe(struct usb_interface *intf,
 	usb_set_intfdata(intf, dev);
 	priv->udev = udev;
 
-	usb_get_dev(udev);
-
 	skb_queue_head_init(&priv->rx_queue);
 
 	BUILD_BUG_ON(sizeof(priv->channels) != sizeof(rtl818x_channels));
@@ -1663,7 +1661,6 @@ static int rtl8187_probe(struct usb_interface *intf,
  err_free_dmabuf:
 	kfree(priv->io_dmabuf);
 	usb_set_intfdata(intf, NULL);
-	usb_put_dev(udev);
  err_free_dev:
 	ieee80211_free_hw(dev);
 	return err;
@@ -1685,7 +1682,6 @@ static void rtl8187_disconnect(struct usb_interface *intf)
 
 	priv = dev->priv;
 	usb_reset_device(priv->udev);
-	usb_put_dev(interface_to_usbdev(intf));
 	kfree(priv->io_dmabuf);
 	ieee80211_free_hw(dev);
 }
-- 
2.52.0


^ permalink raw reply related

* [PATCH v2 18/18] wifi: rtw88: fix device leak on probe failure
From: Johan Hovold @ 2026-03-06  8:51 UTC (permalink / raw)
  To: linux-wireless
  Cc: Jeff Johnson, Toke Høiland-Jørgensen, Brian Norris,
	Francesco Dolcini, Felix Fietkau, Lorenzo Bianconi, Ryder Lee,
	Shayne Chen, Sean Wang, Jakub Kicinski, Stanislaw Gruszka,
	Hin-Tak Leung, Jes Sorensen, Ping-Ke Shih, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Matthias Brugger,
	AngeloGioacchino Del Regno, Greg Kroah-Hartman, libertas-dev,
	linux-kernel, Johan Hovold, stable, Sascha Hauer
In-Reply-To: <20260306085144.12064-1-johan@kernel.org>

Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

This driver takes a reference to the USB device during probe but does
not to release it on all probe errors (e.g. when descriptor parsing
fails).

Drop the redundant device reference to fix the leak, reduce cargo
culting, make it easier to spot drivers where an extra reference is
needed, and reduce the risk of further memory leaks.

Fixes: a82dfd33d123 ("wifi: rtw88: Add common USB chip support")
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/netdev/2026022319-turbofan-darkened-206d@gregkh/
Cc: stable@vger.kernel.org	# 6.2
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/net/wireless/realtek/rtw88/usb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c
index 433b06c8d8a6..718940ebba31 100644
--- a/drivers/net/wireless/realtek/rtw88/usb.c
+++ b/drivers/net/wireless/realtek/rtw88/usb.c
@@ -1041,7 +1041,7 @@ static int rtw_usb_intf_init(struct rtw_dev *rtwdev,
 			     struct usb_interface *intf)
 {
 	struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev);
-	struct usb_device *udev = usb_get_dev(interface_to_usbdev(intf));
+	struct usb_device *udev = interface_to_usbdev(intf);
 	int ret;
 
 	rtwusb->udev = udev;
@@ -1067,7 +1067,6 @@ static void rtw_usb_intf_deinit(struct rtw_dev *rtwdev,
 {
 	struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev);
 
-	usb_put_dev(rtwusb->udev);
 	kfree(rtwusb->usb_data);
 	usb_set_intfdata(intf, NULL);
 }
-- 
2.52.0


^ permalink raw reply related

* [PATCH v2 17/18] wifi: rtl8xxxu: drop redundant device reference
From: Johan Hovold @ 2026-03-06  8:51 UTC (permalink / raw)
  To: linux-wireless
  Cc: Jeff Johnson, Toke Høiland-Jørgensen, Brian Norris,
	Francesco Dolcini, Felix Fietkau, Lorenzo Bianconi, Ryder Lee,
	Shayne Chen, Sean Wang, Jakub Kicinski, Stanislaw Gruszka,
	Hin-Tak Leung, Jes Sorensen, Ping-Ke Shih, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Matthias Brugger,
	AngeloGioacchino Del Regno, Greg Kroah-Hartman, libertas-dev,
	linux-kernel, Johan Hovold
In-Reply-To: <20260306085144.12064-1-johan@kernel.org>

Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/net/wireless/realtek/rtl8xxxu/core.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 794187d28caa..f131ca09ae43 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -7698,7 +7698,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
 	int ret;
 	int untested = 1;
 
-	udev = usb_get_dev(interface_to_usbdev(interface));
+	udev = interface_to_usbdev(interface);
 
 	switch (id->idVendor) {
 	case USB_VENDOR_ID_REALTEK:
@@ -7756,10 +7756,8 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
 	}
 
 	hw = ieee80211_alloc_hw(sizeof(struct rtl8xxxu_priv), &rtl8xxxu_ops);
-	if (!hw) {
-		ret = -ENOMEM;
-		goto err_put_dev;
-	}
+	if (!hw)
+		return -ENOMEM;
 
 	priv = hw->priv;
 	priv->hw = hw;
@@ -7901,8 +7899,6 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
 	mutex_destroy(&priv->h2c_mutex);
 
 	ieee80211_free_hw(hw);
-err_put_dev:
-	usb_put_dev(udev);
 
 	return ret;
 }
@@ -7935,7 +7931,6 @@ static void rtl8xxxu_disconnect(struct usb_interface *interface)
 			 "Device still attached, trying to reset\n");
 		usb_reset_device(priv->udev);
 	}
-	usb_put_dev(priv->udev);
 	ieee80211_free_hw(hw);
 }
 
-- 
2.52.0


^ permalink raw reply related

* [PATCH v2 13/18] wifi: mt76: mt792xu: drop redundant device reference
From: Johan Hovold @ 2026-03-06  8:51 UTC (permalink / raw)
  To: linux-wireless
  Cc: Jeff Johnson, Toke Høiland-Jørgensen, Brian Norris,
	Francesco Dolcini, Felix Fietkau, Lorenzo Bianconi, Ryder Lee,
	Shayne Chen, Sean Wang, Jakub Kicinski, Stanislaw Gruszka,
	Hin-Tak Leung, Jes Sorensen, Ping-Ke Shih, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Matthias Brugger,
	AngeloGioacchino Del Regno, Greg Kroah-Hartman, libertas-dev,
	linux-kernel, Johan Hovold
In-Reply-To: <20260306085144.12064-1-johan@kernel.org>

Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7921/usb.c | 2 --
 drivers/net/wireless/mediatek/mt76/mt7925/usb.c | 2 --
 drivers/net/wireless/mediatek/mt76/mt792x_usb.c | 1 -
 3 files changed, 5 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/usb.c b/drivers/net/wireless/mediatek/mt76/mt7921/usb.c
index 17057e68bf21..9bfc234f306f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/usb.c
@@ -197,7 +197,6 @@ static int mt7921u_probe(struct usb_interface *usb_intf,
 	dev->fw_features = features;
 	dev->hif_ops = &hif_ops;
 
-	udev = usb_get_dev(udev);
 	usb_reset_device(udev);
 
 	usb_set_intfdata(usb_intf, dev);
@@ -246,7 +245,6 @@ static int mt7921u_probe(struct usb_interface *usb_intf,
 	mt76u_queues_deinit(&dev->mt76);
 
 	usb_set_intfdata(usb_intf, NULL);
-	usb_put_dev(interface_to_usbdev(usb_intf));
 
 	mt76_free_device(&dev->mt76);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/usb.c b/drivers/net/wireless/mediatek/mt76/mt7925/usb.c
index d9968f03856d..84bcebbf009a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/usb.c
@@ -185,7 +185,6 @@ static int mt7925u_probe(struct usb_interface *usb_intf,
 	dev->fw_features = features;
 	dev->hif_ops = &hif_ops;
 
-	udev = usb_get_dev(udev);
 	usb_reset_device(udev);
 
 	usb_set_intfdata(usb_intf, dev);
@@ -234,7 +233,6 @@ static int mt7925u_probe(struct usb_interface *usb_intf,
 	mt76u_queues_deinit(&dev->mt76);
 
 	usb_set_intfdata(usb_intf, NULL);
-	usb_put_dev(interface_to_usbdev(usb_intf));
 
 	mt76_free_device(&dev->mt76);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_usb.c b/drivers/net/wireless/mediatek/mt76/mt792x_usb.c
index 552808458138..f827e8a56a18 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_usb.c
@@ -306,7 +306,6 @@ void mt792xu_disconnect(struct usb_interface *usb_intf)
 	mt792xu_cleanup(dev);
 
 	usb_set_intfdata(usb_intf, NULL);
-	usb_put_dev(interface_to_usbdev(usb_intf));
 
 	mt76_free_device(&dev->mt76);
 }
-- 
2.52.0


^ permalink raw reply related

* [PATCH v2 15/18] wifi: rt2x00: drop redundant device reference
From: Johan Hovold @ 2026-03-06  8:51 UTC (permalink / raw)
  To: linux-wireless
  Cc: Jeff Johnson, Toke Høiland-Jørgensen, Brian Norris,
	Francesco Dolcini, Felix Fietkau, Lorenzo Bianconi, Ryder Lee,
	Shayne Chen, Sean Wang, Jakub Kicinski, Stanislaw Gruszka,
	Hin-Tak Leung, Jes Sorensen, Ping-Ke Shih, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Matthias Brugger,
	AngeloGioacchino Del Regno, Greg Kroah-Hartman, libertas-dev,
	linux-kernel, Johan Hovold
In-Reply-To: <20260306085144.12064-1-johan@kernel.org>

Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.

Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
index 54599cad78f9..83d00b6baf64 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
@@ -802,14 +802,12 @@ int rt2x00usb_probe(struct usb_interface *usb_intf,
 	struct rt2x00_dev *rt2x00dev;
 	int retval;
 
-	usb_dev = usb_get_dev(usb_dev);
 	usb_reset_device(usb_dev);
 
 	hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
 	if (!hw) {
 		rt2x00_probe_err("Failed to allocate hardware\n");
-		retval = -ENOMEM;
-		goto exit_put_device;
+		return -ENOMEM;
 	}
 
 	usb_set_intfdata(usb_intf, hw);
@@ -851,10 +849,6 @@ int rt2x00usb_probe(struct usb_interface *usb_intf,
 
 exit_free_device:
 	ieee80211_free_hw(hw);
-
-exit_put_device:
-	usb_put_dev(usb_dev);
-
 	usb_set_intfdata(usb_intf, NULL);
 
 	return retval;
@@ -873,11 +867,7 @@ void rt2x00usb_disconnect(struct usb_interface *usb_intf)
 	rt2x00usb_free_reg(rt2x00dev);
 	ieee80211_free_hw(hw);
 
-	/*
-	 * Free the USB device data.
-	 */
 	usb_set_intfdata(usb_intf, NULL);
-	usb_put_dev(interface_to_usbdev(usb_intf));
 }
 EXPORT_SYMBOL_GPL(rt2x00usb_disconnect);
 
-- 
2.52.0


^ permalink raw reply related

* [PATCH v2 08/18] wifi: libertas_tf: drop redundant device reference
From: Johan Hovold @ 2026-03-06  8:51 UTC (permalink / raw)
  To: linux-wireless
  Cc: Jeff Johnson, Toke Høiland-Jørgensen, Brian Norris,
	Francesco Dolcini, Felix Fietkau, Lorenzo Bianconi, Ryder Lee,
	Shayne Chen, Sean Wang, Jakub Kicinski, Stanislaw Gruszka,
	Hin-Tak Leung, Jes Sorensen, Ping-Ke Shih, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Matthias Brugger,
	AngeloGioacchino Del Regno, Greg Kroah-Hartman, libertas-dev,
	linux-kernel, Johan Hovold
In-Reply-To: <20260306085144.12064-1-johan@kernel.org>

Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/net/wireless/marvell/libertas_tf/if_usb.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/libertas_tf/if_usb.c b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
index f49151c18b79..07b38f2b8f58 100644
--- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
@@ -223,7 +223,6 @@ static int if_usb_probe(struct usb_interface *intf,
 	if (!priv)
 		goto dealloc;
 
-	usb_get_dev(udev);
 	usb_set_intfdata(intf, cardp);
 
 	return 0;
@@ -258,7 +257,6 @@ static void if_usb_disconnect(struct usb_interface *intf)
 	kfree(cardp);
 
 	usb_set_intfdata(intf, NULL);
-	usb_put_dev(interface_to_usbdev(intf));
 
 	lbtf_deb_leave(LBTF_DEB_MAIN);
 }
-- 
2.52.0


^ permalink raw reply related

* [PATCH v2 14/18] wifi: mt7601u: drop redundant device reference
From: Johan Hovold @ 2026-03-06  8:51 UTC (permalink / raw)
  To: linux-wireless
  Cc: Jeff Johnson, Toke Høiland-Jørgensen, Brian Norris,
	Francesco Dolcini, Felix Fietkau, Lorenzo Bianconi, Ryder Lee,
	Shayne Chen, Sean Wang, Jakub Kicinski, Stanislaw Gruszka,
	Hin-Tak Leung, Jes Sorensen, Ping-Ke Shih, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Matthias Brugger,
	AngeloGioacchino Del Regno, Greg Kroah-Hartman, libertas-dev,
	linux-kernel, Johan Hovold
In-Reply-To: <20260306085144.12064-1-johan@kernel.org>

Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/net/wireless/mediatek/mt7601u/usb.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt7601u/usb.c b/drivers/net/wireless/mediatek/mt7601u/usb.c
index c41ae251cb95..9306870cbc91 100644
--- a/drivers/net/wireless/mediatek/mt7601u/usb.c
+++ b/drivers/net/wireless/mediatek/mt7601u/usb.c
@@ -274,7 +274,6 @@ static int mt7601u_probe(struct usb_interface *usb_intf,
 	if (!dev)
 		return -ENOMEM;
 
-	usb_dev = usb_get_dev(usb_dev);
 	usb_reset_device(usb_dev);
 
 	usb_set_intfdata(usb_intf, dev);
@@ -319,7 +318,6 @@ static int mt7601u_probe(struct usb_interface *usb_intf,
 	mt7601u_cleanup(dev);
 err:
 	usb_set_intfdata(usb_intf, NULL);
-	usb_put_dev(interface_to_usbdev(usb_intf));
 
 	destroy_workqueue(dev->stat_wq);
 	ieee80211_free_hw(dev->hw);
@@ -334,7 +332,6 @@ static void mt7601u_disconnect(struct usb_interface *usb_intf)
 	mt7601u_cleanup(dev);
 
 	usb_set_intfdata(usb_intf, NULL);
-	usb_put_dev(interface_to_usbdev(usb_intf));
 
 	destroy_workqueue(dev->stat_wq);
 	ieee80211_free_hw(dev->hw);
-- 
2.52.0


^ permalink raw reply related

* [PATCH v2 02/18] wifi: ath6kl: rename disconnect callback
From: Johan Hovold @ 2026-03-06  8:51 UTC (permalink / raw)
  To: linux-wireless
  Cc: Jeff Johnson, Toke Høiland-Jørgensen, Brian Norris,
	Francesco Dolcini, Felix Fietkau, Lorenzo Bianconi, Ryder Lee,
	Shayne Chen, Sean Wang, Jakub Kicinski, Stanislaw Gruszka,
	Hin-Tak Leung, Jes Sorensen, Ping-Ke Shih, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Matthias Brugger,
	AngeloGioacchino Del Regno, Greg Kroah-Hartman, libertas-dev,
	linux-kernel, Johan Hovold
In-Reply-To: <20260306085144.12064-1-johan@kernel.org>

Rename the disconnect callback so that it reflects the callback name for
consistency with the rest of the kernel (e.g. makes it easier to grep
for).

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/net/wireless/ath/ath6kl/usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c
index 814faf96f1ff..79c18f5ee02b 100644
--- a/drivers/net/wireless/ath/ath6kl/usb.c
+++ b/drivers/net/wireless/ath/ath6kl/usb.c
@@ -1175,7 +1175,7 @@ static int ath6kl_usb_probe(struct usb_interface *interface,
 	return ret;
 }
 
-static void ath6kl_usb_remove(struct usb_interface *interface)
+static void ath6kl_usb_disconnect(struct usb_interface *interface)
 {
 	ath6kl_usb_device_detached(interface);
 }
@@ -1227,7 +1227,7 @@ static struct usb_driver ath6kl_usb_driver = {
 	.probe = ath6kl_usb_probe,
 	.suspend = ath6kl_usb_pm_suspend,
 	.resume = ath6kl_usb_pm_resume,
-	.disconnect = ath6kl_usb_remove,
+	.disconnect = ath6kl_usb_disconnect,
 	.id_table = ath6kl_usb_ids,
 	.supports_autosuspend = true,
 	.disable_hub_initiated_lpm = 1,
-- 
2.52.0


^ permalink raw reply related

* [PATCH v2 10/18] wifi: mt76: drop redundant device reference
From: Johan Hovold @ 2026-03-06  8:51 UTC (permalink / raw)
  To: linux-wireless
  Cc: Jeff Johnson, Toke Høiland-Jørgensen, Brian Norris,
	Francesco Dolcini, Felix Fietkau, Lorenzo Bianconi, Ryder Lee,
	Shayne Chen, Sean Wang, Jakub Kicinski, Stanislaw Gruszka,
	Hin-Tak Leung, Jes Sorensen, Ping-Ke Shih, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Matthias Brugger,
	AngeloGioacchino Del Regno, Greg Kroah-Hartman, libertas-dev,
	linux-kernel, Johan Hovold
In-Reply-To: <20260306085144.12064-1-johan@kernel.org>

Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7615/usb.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/usb.c b/drivers/net/wireless/mediatek/mt76/mt7615/usb.c
index d91feffadda9..bab7b91f14be 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/usb.c
@@ -151,7 +151,6 @@ static int mt7663u_probe(struct usb_interface *usb_intf,
 		return -ENOMEM;
 
 	dev = container_of(mdev, struct mt7615_dev, mt76);
-	udev = usb_get_dev(udev);
 	usb_reset_device(udev);
 
 	usb_set_intfdata(usb_intf, dev);
@@ -193,7 +192,6 @@ static int mt7663u_probe(struct usb_interface *usb_intf,
 error:
 	mt76u_queues_deinit(&dev->mt76);
 	usb_set_intfdata(usb_intf, NULL);
-	usb_put_dev(interface_to_usbdev(usb_intf));
 
 	mt76_free_device(&dev->mt76);
 
@@ -211,7 +209,6 @@ static void mt7663u_disconnect(struct usb_interface *usb_intf)
 	mt7663u_cleanup(dev);
 
 	usb_set_intfdata(usb_intf, NULL);
-	usb_put_dev(interface_to_usbdev(usb_intf));
 
 	mt76_free_device(&dev->mt76);
 }
-- 
2.52.0


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox