[PATCH 00/13] wifi: drop redundant USB device references

Johan Hovold posted 13 patches 1 month ago
There is a newer version of this series
drivers/net/wireless/atmel/at76c50x-usb.c          | 12 ++++--------
drivers/net/wireless/marvell/libertas/if_usb.c     |  3 ---
drivers/net/wireless/marvell/libertas_tf/if_usb.c  |  2 --
drivers/net/wireless/marvell/mwifiex/usb.c         |  4 ----
drivers/net/wireless/mediatek/mt76/mt7615/usb.c    |  3 ---
drivers/net/wireless/mediatek/mt76/mt76x0/usb.c    |  3 ---
drivers/net/wireless/mediatek/mt76/mt76x2/usb.c    |  4 ----
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 -
drivers/net/wireless/mediatek/mt7601u/usb.c        |  3 ---
drivers/net/wireless/ralink/rt2x00/rt2x00usb.c     | 12 +-----------
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 ----
15 files changed, 8 insertions(+), 62 deletions(-)
[PATCH 00/13] wifi: drop redundant USB device references
Posted by Johan Hovold 1 month ago
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 redundant device references 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 them.

Note that I sent an ath9k patch separately here:

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

but I guess these can all be picked up by Johannes.

Johan


Johan Hovold (13):
  wifi: at76c50x: drop redundant device reference
  wifi: libertas: drop redundant device reference
  wifi: libertas_tf: drop redundant device reference
  wifi: mwifiex: drop redundant device reference
  wifi: mt76: drop redundant device reference
  wifi: mt76x0u: drop redundant device reference
  wifi: mt76x2u: drop redundant device reference
  wifi: mt76: mt792xu: drop redundant device reference
  wifi: mt7601u: drop redundant device reference
  wifi: rt2x00: drop redundant device reference
  wifi: rtl818x: drop redundant device reference
  wifi: rtl8xxxu: drop redundant device reference
  wifi: rtlwifi: usb: drop redundant device reference

 drivers/net/wireless/atmel/at76c50x-usb.c          | 12 ++++--------
 drivers/net/wireless/marvell/libertas/if_usb.c     |  3 ---
 drivers/net/wireless/marvell/libertas_tf/if_usb.c  |  2 --
 drivers/net/wireless/marvell/mwifiex/usb.c         |  4 ----
 drivers/net/wireless/mediatek/mt76/mt7615/usb.c    |  3 ---
 drivers/net/wireless/mediatek/mt76/mt76x0/usb.c    |  3 ---
 drivers/net/wireless/mediatek/mt76/mt76x2/usb.c    |  4 ----
 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 -
 drivers/net/wireless/mediatek/mt7601u/usb.c        |  3 ---
 drivers/net/wireless/ralink/rt2x00/rt2x00usb.c     | 12 +-----------
 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 ----
 15 files changed, 8 insertions(+), 62 deletions(-)

-- 
2.52.0
RE: [PATCH 00/13] wifi: drop redundant USB device references
Posted by Ping-Ke Shih 1 month ago
// +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? 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/

Ping-Ke
Re: [PATCH 00/13] wifi: drop redundant USB device references
Posted by Johan Hovold 1 month ago
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.

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

Johan
RE: [PATCH 00/13] wifi: drop redundant USB device references
Posted by Ping-Ke Shih 1 month ago
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
Re: [PATCH 00/13] wifi: drop redundant USB device references
Posted by Greg Kroah-Hartman 1 month ago
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
Re: [PATCH 00/13] wifi: drop redundant USB device references
Posted by Johan Hovold 1 month ago
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
RE: [PATCH 00/13] wifi: drop redundant USB device references
Posted by Ping-Ke Shih 1 month ago
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