diff mbox

[06/12] cfg80211: some workqueue improvements

Message ID 84aff9f5916be0f5cfaa4f145670d0ee06fcf4bf.1398055854.git.gamerh2o@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Gang ZHAO April 21, 2014, 4:53 a.m. UTC
Works rdev->rfkill_sync and rdev->sched_scan_results_wk are safely
stopped when unregistering wiphy.

Work reg_regdb_work is safely stopped in regulatory_exit(), if related
config option is enabled.

Queue work cfg80211_disconnect_work to workqueue cfg80211_wq, since
it's a work owned by cfg80211, and so it can be safely stopped in
destroy_workqueue(cfg80211_wq) in cfg80211_exit().

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

Comments

Johannes Berg April 22, 2014, 2:50 p.m. UTC | #1
On Mon, 2014-04-21 at 12:53 +0800, Zhao, Gang wrote:
> Works rdev->rfkill_sync and rdev->sched_scan_results_wk are safely
> stopped when unregistering wiphy.
> 
> Work reg_regdb_work is safely stopped in regulatory_exit(), if related
> config option is enabled.
> 
> Queue work cfg80211_disconnect_work to workqueue cfg80211_wq, since
> it's a work owned by cfg80211, and so it can be safely stopped in
> destroy_workqueue(cfg80211_wq) in cfg80211_exit().

Nope ... think about locking.

> Change flush_work() to more robust cancel_work_sync().

These are not equivalent.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/wireless/core.c b/net/wireless/core.c
index 33d12e2..f7f71d9 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -711,9 +711,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);
 	flush_work(&rdev->destroy_work);
 
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 9d32633..45b61f0 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2765,6 +2765,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 998674f..0a96d67 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -872,7 +872,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,