aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/util.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-05-08 15:45:15 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-05-24 18:02:15 -0400
commit5fe231e873729fa2f57cdc417d5c1f80871e2d7d (patch)
tree48810991fa4cf4faa69c0a992fdaf962feb6edda /net/wireless/util.c
parent73810b77def898b43a97638478692922b7f820eb (diff)
cfg80211: vastly simplify locking
Virtually all code paths in cfg80211 already (need to) hold the RTNL. As such, there's little point in having another four mutexes for various parts of the code, they just cause lock ordering issues (and much of the time, the RTNL and a few of the others need thus be held.) Simplify all this by getting rid of the extra four mutexes and just use the RTNL throughout. Only a few code changes were needed to do this and we can get rid of a work struct for bonus points. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/util.c')
-rw-r--r--net/wireless/util.c11
1 files changed, 0 insertions, 11 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 0962f107f57f..501724257af5 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -808,12 +808,8 @@ void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev)
808 ASSERT_RTNL(); 808 ASSERT_RTNL();
809 ASSERT_RDEV_LOCK(rdev); 809 ASSERT_RDEV_LOCK(rdev);
810 810
811 mutex_lock(&rdev->devlist_mtx);
812
813 list_for_each_entry(wdev, &rdev->wdev_list, list) 811 list_for_each_entry(wdev, &rdev->wdev_list, list)
814 cfg80211_process_wdev_events(wdev); 812 cfg80211_process_wdev_events(wdev);
815
816 mutex_unlock(&rdev->devlist_mtx);
817} 813}
818 814
819int cfg80211_change_iface(struct cfg80211_registered_device *rdev, 815int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
@@ -845,10 +841,8 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
845 return -EBUSY; 841 return -EBUSY;
846 842
847 if (ntype != otype && netif_running(dev)) { 843 if (ntype != otype && netif_running(dev)) {
848 mutex_lock(&rdev->devlist_mtx);
849 err = cfg80211_can_change_interface(rdev, dev->ieee80211_ptr, 844 err = cfg80211_can_change_interface(rdev, dev->ieee80211_ptr,
850 ntype); 845 ntype);
851 mutex_unlock(&rdev->devlist_mtx);
852 if (err) 846 if (err)
853 return err; 847 return err;
854 848
@@ -1210,8 +1204,6 @@ int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
1210 if (!beacon_int) 1204 if (!beacon_int)
1211 return -EINVAL; 1205 return -EINVAL;
1212 1206
1213 mutex_lock(&rdev->devlist_mtx);
1214
1215 list_for_each_entry(wdev, &rdev->wdev_list, list) { 1207 list_for_each_entry(wdev, &rdev->wdev_list, list) {
1216 if (!wdev->beacon_interval) 1208 if (!wdev->beacon_interval)
1217 continue; 1209 continue;
@@ -1221,8 +1213,6 @@ int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
1221 } 1213 }
1222 } 1214 }
1223 1215
1224 mutex_unlock(&rdev->devlist_mtx);
1225
1226 return res; 1216 return res;
1227} 1217}
1228 1218
@@ -1246,7 +1236,6 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
1246 int i, j; 1236 int i, j;
1247 1237
1248 ASSERT_RTNL(); 1238 ASSERT_RTNL();
1249 lockdep_assert_held(&rdev->devlist_mtx);
1250 1239
1251 if (WARN_ON(hweight32(radar_detect) > 1)) 1240 if (WARN_ON(hweight32(radar_detect) > 1))
1252 return -EINVAL; 1241 return -EINVAL;