public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Ville Nummela <ville@nummela.org>
To: linux-wireless@vger.kernel.org
Subject: [PATCH] wifi: rsi_91x_usb: do not pause rfkill polling when stopping mac80211
Date: Tue, 17 Mar 2026 09:36:05 +0000	[thread overview]
Message-ID: <20260317093605.Horde.9WKqN4PAUyX4gAKkAiaQzv9@www.nummela.org> (raw)


Removing rsi_91x USB adapter could cause rtnetlink to lock up.
When rsi_mac80211_stop is called, wiphy_lock is locked. Call to
wiphy_rfkill_stop_polling would wait until the work queue has
finished, but because the work queue waits for wiphy_lock, that
would never happen.

Moving the call to rsi_disconnect avoids the lock up.

Signed-off-by: Ville Nummela <ville.nummela@kempower.com>
---
   drivers/net/wireless/rsi/rsi_91x_mac80211.c | 17 ++++++++++++++++-
   drivers/net/wireless/rsi/rsi_91x_usb.c      |  2 ++
   drivers/net/wireless/rsi/rsi_common.h       |  1 +
   3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c  
b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index c7ae8031436a..c1fbd16ac2f7 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -325,6 +325,22 @@ void rsi_mac80211_detach(struct rsi_hw *adapter)
   }
   EXPORT_SYMBOL_GPL(rsi_mac80211_detach);

+/**
+ * rsi_mac80211_rfkill_exit() - This function is used to stop rfkill polling
+ *                              when the device is removed.
+ * @adapter: Pointer to the adapter structure.
+ *
+ * Return: None.
+ */
+void rsi_mac80211_rfkill_exit(struct rsi_hw *adapter)
+{
+	struct ieee80211_hw *hw = adapter->hw;
+	if (hw) {
+		wiphy_rfkill_stop_polling(hw->wiphy);
+	}
+}
+EXPORT_SYMBOL_GPL(rsi_mac80211_rfkill_exit);
+
   /**
    * rsi_indicate_tx_status() - This function indicates the transmit status.
    * @adapter: Pointer to the adapter structure.
@@ -422,7 +438,6 @@ static void rsi_mac80211_stop(struct ieee80211_hw  
*hw, bool suspend)
   	rsi_dbg(ERR_ZONE, "===> Interface DOWN <===\n");
   	mutex_lock(&common->mutex);
   	common->iface_down = true;
-	wiphy_rfkill_stop_polling(hw->wiphy);

   	/* Block all rx frames */
   	rsi_send_rx_filter_frame(common, 0xffff);
diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c  
b/drivers/net/wireless/rsi/rsi_91x_usb.c
index d83204701e27..8765cac6f875 100644
--- a/drivers/net/wireless/rsi/rsi_91x_usb.c
+++ b/drivers/net/wireless/rsi/rsi_91x_usb.c
@@ -877,6 +877,8 @@ static void rsi_disconnect(struct usb_interface  
*pfunction)
   	if (!adapter)
   		return;

+	rsi_mac80211_rfkill_exit(adapter);
+
   	rsi_mac80211_detach(adapter);

   	if (IS_ENABLED(CONFIG_RSI_COEX) && adapter->priv->coex_mode > 1 &&
diff --git a/drivers/net/wireless/rsi/rsi_common.h  
b/drivers/net/wireless/rsi/rsi_common.h
index 7aa5124575cf..591602beeec6 100644
--- a/drivers/net/wireless/rsi/rsi_common.h
+++ b/drivers/net/wireless/rsi/rsi_common.h
@@ -79,6 +79,7 @@ static inline int rsi_kill_thread(struct rsi_thread *handle)
   }

   void rsi_mac80211_detach(struct rsi_hw *hw);
+void rsi_mac80211_rfkill_exit(struct rsi_hw *hw);
   u16 rsi_get_connected_channel(struct ieee80211_vif *vif);
   struct rsi_hw *rsi_91x_init(u16 oper_mode);
   void rsi_91x_deinit(struct rsi_hw *adapter);
--
2.34.1



             reply	other threads:[~2026-03-17  9:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17  9:36 Ville Nummela [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-03-17  9:20 [PATCH] wifi: rsi_91x_usb: do not pause rfkill polling when stopping mac80211 Ville Nummela

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=20260317093605.Horde.9WKqN4PAUyX4gAKkAiaQzv9@www.nummela.org \
    --to=ville@nummela.org \
    --cc=linux-wireless@vger.kernel.org \
    /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