diff mbox

[1/6] cfg80211: some workqueue improvements

Message ID 8b5c4a61ae1f49400478b030fa7ae4e3a5ca2bcb.1397469035.git.gamerh2o@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Gang ZHAO April 14, 2014, 9:51 a.m. UTC
Rdev->rfkill_sync and rdev->sched_scan_results_wk works are canceled
when unregistering wiphy.

Reg_regdb_work is canceled in regulatory_exit(), if related config
option is enabled.

Queue cfg80211_disconnect_work to cfg80211_wq, since it's a work used
by cfg80211.

Change flush_work() to more robust cancel_work_sync().

Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
---
 net/wireless/core.c | 6 ++++--
 net/wireless/reg.c  | 4 ++++
 net/wireless/sme.c  | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/net/wireless/core.c b/net/wireless/core.c
index 276cf93..68a027c 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -671,9 +671,11 @@  void wiphy_unregister(struct wiphy *wiphy)
 
 	rtnl_unlock();
 
-	flush_work(&rdev->scan_done_wk);
+	cancel_work_sync(&rdev->rfkill_sync);
+	cancel_work_sync(&rdev->scan_done_wk);
+	cancel_work_sync(&rdev->sched_scan_results_wk);
 	cancel_work_sync(&rdev->conn_work);
-	flush_work(&rdev->event_work);
+	cancel_work_sync(&rdev->event_work);
 	cancel_delayed_work_sync(&rdev->dfs_update_channels_wk);
 
 #ifdef CONFIG_PM
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index f59aaac..12d3194 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2666,6 +2666,10 @@  void regulatory_exit(void)
 	cancel_work_sync(&reg_work);
 	cancel_delayed_work_sync(&reg_timeout);
 
+#ifdef CONFIG_CFG80211_INTERNAL_REGDB
+	cancel_work_sync(&reg_regdb_work);
+#endif
+
 	/* Lock to suppress warnings */
 	rtnl_lock();
 	reset_regdomains(true, NULL);
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index acdcb4a8..11b2779 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -873,7 +873,7 @@  void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
 	wdev->wext.connect.ssid_len = 0;
 #endif
 
-	schedule_work(&cfg80211_disconnect_work);
+	queue_work(cfg80211_wq, &cfg80211_disconnect_work);
 }
 
 void cfg80211_disconnected(struct net_device *dev, u16 reason,