linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Bitterblue Smith <rtl8821cerfe2@gmail.com>,
	"kvalo@kernel.org" <kvalo@kernel.org>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"Larry.Finger@lwfinger.net" <Larry.Finger@lwfinger.net>,
	"s.l-h@gmx.de" <s.l-h@gmx.de>,
	"chewitt@libreelec.tv" <chewitt@libreelec.tv>
Subject: RE: [PATCH v3 11/12] wifi: rtlwifi: Add rtl8192du/sw.{c,h}
Date: Mon, 8 Apr 2024 02:45:49 +0000	[thread overview]
Message-ID: <21299940bf9342ae9c82916084ea7d9e@realtek.com> (raw)
In-Reply-To: <321c6855-2e58-48ae-b131-a3f6d7041713@gmail.com>


> I did not consider using a ref_cnt variable. I made the first
> probe allocate the things and the first disconnect frees them:

The allocation seems fine, but I feel we should free shared data by second
disconnect because the other intf can still use them, no?

> 
> 
> static struct usb_interface *rtl92du_get_other_intf(struct ieee80211_hw *hw)
> {
>         struct usb_interface *intf;
>         struct usb_device *udev;
>         u8 other_interfaceindex;
> 
>         /* See SET_IEEE80211_DEV(hw, &intf->dev); in usb.c */
>         intf = container_of_const(wiphy_dev(hw->wiphy), struct usb_interface, dev);
> 
>         other_interfaceindex = 1 - intf->altsetting[0].desc.bInterfaceNumber;

The value of bInterfaceNumber for two instances are 0 and 1, right? Then
'1 - x' to get each other -- that looks a little tricky ;-) 

> 
>         udev = interface_to_usbdev(intf);
> 
>         return usb_ifnum_to_if(udev, other_interfaceindex);
> }
> 

[...]

> 
> static void rtl92du_deinit_shared_data(struct ieee80211_hw *hw)
> {
>         struct usb_interface *other_intf = rtl92du_get_other_intf(hw);
>         struct rtl_priv *rtlpriv = rtl_priv(hw);
> 
>         if (!other_intf || usb_get_intfdata(other_intf)) {
>                 /* The other interface doesn't exist or was not disconnected yet. */

For the USB adaptor with single one interface, you don't have other_intf.
Then, just free them.

If the USB adaptor has two interfaces, it has both other_intf and
usb_get_intfdata(other_intf), so you want to free them. But, I wonder if both 
interfaces can enter this branch?

Also as I mentioned above, how can you ensure other_intf isn't still using the
shared data?


>                 kfree(rtlpriv->curveindex_2g);
>                 kfree(rtlpriv->curveindex_5g);
>                 if (rtlpriv->mutex_for_power_on_off)
>                         mutex_destroy(rtlpriv->mutex_for_power_on_off);
>                 if (rtlpriv->mutex_for_hw_init)
>                         mutex_destroy(rtlpriv->mutex_for_hw_init);
>                 kfree(rtlpriv->mutex_for_power_on_off);
>                 kfree(rtlpriv->mutex_for_hw_init);
>         }
> }
> 

[...]


  reply	other threads:[~2024-04-08  2:46 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 19:32 [PATCH v3 00/12] wifi: rtlwifi: Add new rtl8192du driver Bitterblue Smith
2024-03-20 19:33 ` [PATCH v3 01/12] wifi: rtlwifi: rtl8192de: Fix 5 GHz TX power Bitterblue Smith
2024-03-22  1:25   ` Ping-Ke Shih
2024-03-20 19:34 ` [PATCH v3 02/12] wifi: rtlwifi: Move code from rtl8192de to rtl8192d-common Bitterblue Smith
2024-03-22  2:14   ` Ping-Ke Shih
2024-03-26 13:02     ` Bitterblue Smith
2024-03-20 19:35 ` [PATCH v3 03/12] wifi: rtlwifi: Adjust rtl8192d-common for USB Bitterblue Smith
2024-03-22  3:41   ` Ping-Ke Shih
2024-03-20 19:36 ` [PATCH v3 04/12] wifi: rtlwifi: Add rtl8192du/table.{c,h} Bitterblue Smith
2024-03-22  3:46   ` Ping-Ke Shih
2024-03-26 17:30     ` Bitterblue Smith
2024-03-27  9:18       ` Kalle Valo
2024-03-27  9:30         ` Ping-Ke Shih
2024-03-27 12:36           ` Bitterblue Smith
2024-03-27 12:42             ` Ping-Ke Shih
2024-03-27 12:53             ` Kalle Valo
2024-03-27 16:34           ` Jeff Johnson
2024-03-20 19:37 ` [PATCH v3 05/12] wifi: rtlwifi: Add rtl8192du/hw.{c,h} Bitterblue Smith
2024-03-22  4:02   ` Ping-Ke Shih
2024-03-20 19:38 ` [PATCH v3 06/12] wifi: rtlwifi: Add rtl8192du/phy.{c,h} Bitterblue Smith
2024-03-22  5:22   ` Ping-Ke Shih
2024-03-26 22:13     ` Bitterblue Smith
2024-03-27  1:19       ` Ping-Ke Shih
2024-03-20 19:39 ` [PATCH v3 07/12] wifi: rtlwifi: Add rtl8192du/trx.{c,h} Bitterblue Smith
2024-03-22  5:32   ` Ping-Ke Shih
2024-03-20 19:40 ` [PATCH v3 08/12] wifi: rtlwifi: Add rtl8192du/rf.{c,h} Bitterblue Smith
2024-03-22  5:35   ` Ping-Ke Shih
2024-03-20 19:41 ` [PATCH v3 09/12] wifi: rtlwifi: Add rtl8192du/fw.{c,h} and rtl8192du/led.{c,h} Bitterblue Smith
2024-03-22  5:42   ` Ping-Ke Shih
2024-03-20 19:42 ` [PATCH v3 10/12] wifi: rtlwifi: Add rtl8192du/dm.{c,h} Bitterblue Smith
2024-03-22  5:48   ` Ping-Ke Shih
2024-03-20 19:43 ` [PATCH v3 11/12] wifi: rtlwifi: Add rtl8192du/sw.{c,h} Bitterblue Smith
2024-03-22  6:04   ` Ping-Ke Shih
2024-03-27 14:07     ` Bitterblue Smith
2024-03-27 18:48       ` Kalle Valo
2024-03-27 22:53         ` Bitterblue Smith
2024-03-28  1:46           ` Ping-Ke Shih
2024-03-28 13:31             ` Bitterblue Smith
2024-03-29  0:34               ` Ping-Ke Shih
2024-03-31 18:48                 ` Bitterblue Smith
2024-04-01  1:21                   ` Ping-Ke Shih
2024-04-07 12:03                     ` Bitterblue Smith
2024-04-08  2:45                       ` Ping-Ke Shih [this message]
2024-04-08  9:01                         ` Bitterblue Smith
2024-04-09  0:27                           ` Ping-Ke Shih
2024-04-09 11:16                             ` Bitterblue Smith
2024-03-28  1:49       ` Ping-Ke Shih
2024-03-20 19:44 ` [PATCH v3 12/12] wifi: rtlwifi: Enable the new rtl8192du driver Bitterblue Smith
2024-03-22  6:06   ` Ping-Ke Shih
2024-03-21  1:10 ` [PATCH v3 00/12] wifi: rtlwifi: Add " Stefan Lippers-Hollmann
2024-03-22  6:13 ` [PATCH v3 01/12] wifi: rtlwifi: rtl8192de: Fix 5 GHz TX power Ping-Ke Shih

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=21299940bf9342ae9c82916084ea7d9e@realtek.com \
    --to=pkshih@realtek.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=chewitt@libreelec.tv \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rtl8821cerfe2@gmail.com \
    --cc=s.l-h@gmx.de \
    /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;
as well as URLs for NNTP newsgroup(s).