linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: mt76: mt7921: Cancel scan work on unregister.
@ 2024-08-06 22:21 David Ruth
  2024-08-07  9:19 ` kernel test robot
  2024-08-07 10:31 ` kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: David Ruth @ 2024-08-06 22:21 UTC (permalink / raw)
  To: nbd, lorenzo
  Cc: linux-wireless, timvp, sean.wang, ryder.lee, shayne.chen,
	David Ruth

This change cancels delayed work on the scan_work workqueue before
the workqueue is destroyed by the call to iee80211_unregister_hw in
mt76_unregister_device.

Without this change, if the device rapidly registered and
unregistered, work will attempt to execute on the workqueue after it
is destroyed.

Signed-off-by: David Ruth <druth@chromium.org>
---
 drivers/net/wireless/mediatek/mt76/mt7921/pci.c  | 2 ++
 drivers/net/wireless/mediatek/mt76/mt7921/sdio.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
index a7430216a80d..2c89bbccce4e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
@@ -42,7 +42,9 @@ static void mt7921e_unregister_device(struct mt792x_dev *dev)
 {
 	int i;
 	struct mt76_connac_pm *pm = &dev->pm;
+	struct mt792x_phy *phy = dev->mt76.phy->priv;
 
+	cancel_delayed_work_sync(&phy->scan_work);
 	cancel_work_sync(&dev->init_work);
 	mt76_unregister_device(&dev->mt76);
 	mt76_for_each_q_rx(&dev->mt76, i)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c b/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c
index 004d942ee11a..1bcfb6944a1f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c
@@ -41,7 +41,9 @@ static void mt7921s_txrx_worker(struct mt76_worker *w)
 static void mt7921s_unregister_device(struct mt792x_dev *dev)
 {
 	struct mt76_connac_pm *pm = &dev->pm;
+	struct mt792x_phy *phy = dev->mt76.phy->priv;
 
+	cancel_delayed_work_sync(&phy->scan_work);
 	cancel_work_sync(&dev->init_work);
 	mt76_unregister_device(&dev->mt76);
 	cancel_delayed_work_sync(&pm->ps_work);
-- 
2.46.0.rc2.264.g509ed76dc8-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-07 12:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-06 22:21 [PATCH] wifi: mt76: mt7921: Cancel scan work on unregister David Ruth
2024-08-07  9:19 ` kernel test robot
2024-08-07 10:31 ` kernel test robot
2024-08-07 12:08   ` Kalle Valo

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).