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

* Re: [PATCH] wifi: mt76: mt7921: Cancel scan work on unregister.
  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
  1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2024-08-07  9:19 UTC (permalink / raw)
  To: David Ruth, nbd, lorenzo
  Cc: oe-kbuild-all, linux-wireless, timvp, sean.wang, ryder.lee,
	shayne.chen, David Ruth

Hi David,

kernel test robot noticed the following build errors:

[auto build test ERROR on wireless-next/main]
[also build test ERROR on wireless/main linus/master v6.11-rc2 next-20240807]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/David-Ruth/wifi-mt76-mt7921-Cancel-scan-work-on-unregister/20240807-065202
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20240806222113.2689446-1-druth%40chromium.org
patch subject: [PATCH] wifi: mt76: mt7921: Cancel scan work on unregister.
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240807/202408071657.Qkyy8VqM-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240807/202408071657.Qkyy8VqM-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408071657.Qkyy8VqM-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/net/wireless/mediatek/mt76/mt7921/sdio.c: In function 'mt7921s_unregister_device':
>> drivers/net/wireless/mediatek/mt76/mt7921/sdio.c:44:47: error: invalid type argument of '->' (have 'struct mt76_phy')
      44 |         struct mt792x_phy *phy = dev->mt76.phy->priv;
         |                                               ^~


vim +44 drivers/net/wireless/mediatek/mt76/mt7921/sdio.c

    40	
    41	static void mt7921s_unregister_device(struct mt792x_dev *dev)
    42	{
    43		struct mt76_connac_pm *pm = &dev->pm;
  > 44		struct mt792x_phy *phy = dev->mt76.phy->priv;
    45	
    46		cancel_delayed_work_sync(&phy->scan_work);
    47		cancel_work_sync(&dev->init_work);
    48		mt76_unregister_device(&dev->mt76);
    49		cancel_delayed_work_sync(&pm->ps_work);
    50		cancel_work_sync(&pm->wake_work);
    51	
    52		mt76s_deinit(&dev->mt76);
    53		mt7921s_wfsys_reset(dev);
    54		skb_queue_purge(&dev->mt76.mcu.res_q);
    55	
    56		mt76_free_device(&dev->mt76);
    57	}
    58	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH] wifi: mt76: mt7921: Cancel scan work on unregister.
  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
  1 sibling, 1 reply; 4+ messages in thread
From: kernel test robot @ 2024-08-07 10:31 UTC (permalink / raw)
  To: David Ruth, nbd, lorenzo
  Cc: oe-kbuild-all, linux-wireless, timvp, sean.wang, ryder.lee,
	shayne.chen, David Ruth

Hi David,

kernel test robot noticed the following build errors:

[auto build test ERROR on wireless-next/main]
[also build test ERROR on wireless/main linus/master v6.11-rc2 next-20240807]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/David-Ruth/wifi-mt76-mt7921-Cancel-scan-work-on-unregister/20240807-065202
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20240806222113.2689446-1-druth%40chromium.org
patch subject: [PATCH] wifi: mt76: mt7921: Cancel scan work on unregister.
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20240807/202408071730.Ux9Cr643-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240807/202408071730.Ux9Cr643-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408071730.Ux9Cr643-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/net/wireless/mediatek/mt76/mt7921/pci.c: In function 'mt7921e_unregister_device':
>> drivers/net/wireless/mediatek/mt76/mt7921/pci.c:45:47: error: invalid type argument of '->' (have 'struct mt76_phy')
      45 |         struct mt792x_phy *phy = dev->mt76.phy->priv;
         |                                               ^~


vim +45 drivers/net/wireless/mediatek/mt76/mt7921/pci.c

    40	
    41	static void mt7921e_unregister_device(struct mt792x_dev *dev)
    42	{
    43		int i;
    44		struct mt76_connac_pm *pm = &dev->pm;
  > 45		struct mt792x_phy *phy = dev->mt76.phy->priv;
    46	
    47		cancel_delayed_work_sync(&phy->scan_work);
    48		cancel_work_sync(&dev->init_work);
    49		mt76_unregister_device(&dev->mt76);
    50		mt76_for_each_q_rx(&dev->mt76, i)
    51			napi_disable(&dev->mt76.napi[i]);
    52		cancel_delayed_work_sync(&pm->ps_work);
    53		cancel_work_sync(&pm->wake_work);
    54		cancel_work_sync(&dev->reset_work);
    55	
    56		mt76_connac2_tx_token_put(&dev->mt76);
    57		__mt792x_mcu_drv_pmctrl(dev);
    58		mt792x_dma_cleanup(dev);
    59		mt792x_wfsys_reset(dev);
    60		skb_queue_purge(&dev->mt76.mcu.res_q);
    61	
    62		tasklet_disable(&dev->mt76.irq_tasklet);
    63	}
    64	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH] wifi: mt76: mt7921: Cancel scan work on unregister.
  2024-08-07 10:31 ` kernel test robot
@ 2024-08-07 12:08   ` Kalle Valo
  0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2024-08-07 12:08 UTC (permalink / raw)
  To: kernel test robot
  Cc: David Ruth, nbd, lorenzo, oe-kbuild-all, linux-wireless, timvp,
	sean.wang, ryder.lee, shayne.chen

kernel test robot <lkp@intel.com> writes:

> Hi David,
>
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on wireless-next/main]
> [also build test ERROR on wireless/main linus/master v6.11-rc2 next-20240807]
> [If your patch is applied to the wrong git tree, kindly drop us a note.

I suspect this should be tested on top of Felix's tree:

MEDIATEK MT76 WIRELESS LAN DRIVER
M:	Felix Fietkau <nbd@nbd.name>
M:	Lorenzo Bianconi <lorenzo@kernel.org>
M:	Ryder Lee <ryder.lee@mediatek.com>
R:	Shayne Chen <shayne.chen@mediatek.com>
R:	Sean Wang <sean.wang@mediatek.com>
L:	linux-wireless@vger.kernel.org
S:	Maintained
T:	git https://github.com/nbd168/wireless
F:	Documentation/devicetree/bindings/net/wireless/mediatek,mt76.yaml
F:	drivers/net/wireless/mediatek/mt76/

> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]

Yeah, using --base is very much recommended.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[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).