diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-02-21 00:04:21 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-27 14:52:55 -0500 |
commit | a1794390f1afc3631ac056e0f1677b7ab6f7ee74 (patch) | |
tree | 0c5ff752ba69c6b002369e340e931ce5ef9df0d3 /net/wireless/core.c | |
parent | 85fd129a721e6e892dbaaf05203baf819730f699 (diff) |
cfg80211: rename cfg80211_drv_mutex to cfg80211_mutex
cfg80211_drv_mutex is protecting more than the driver list,
this renames it and documents what its currently supposed to
protect.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/core.c')
-rw-r--r-- | net/wireless/core.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index 35d457b2751e..39d40d1e06db 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -31,7 +31,12 @@ MODULE_DESCRIPTION("wireless configuration support"); | |||
31 | * only read the list, and that can happen quite | 31 | * only read the list, and that can happen quite |
32 | * often because we need to do it for each command */ | 32 | * often because we need to do it for each command */ |
33 | LIST_HEAD(cfg80211_drv_list); | 33 | LIST_HEAD(cfg80211_drv_list); |
34 | DEFINE_MUTEX(cfg80211_drv_mutex); | 34 | |
35 | /* | ||
36 | * This is used to protect the cfg80211_drv_list, cfg80211_regdomain, and | ||
37 | * the last reguluatory request receipt in regd.c | ||
38 | */ | ||
39 | DEFINE_MUTEX(cfg80211_mutex); | ||
35 | 40 | ||
36 | /* for debugfs */ | 41 | /* for debugfs */ |
37 | static struct dentry *ieee80211_debugfs_dir; | 42 | static struct dentry *ieee80211_debugfs_dir; |
@@ -55,7 +60,7 @@ cfg80211_drv_by_wiphy_idx(int wiphy_idx) | |||
55 | return result; | 60 | return result; |
56 | } | 61 | } |
57 | 62 | ||
58 | /* requires cfg80211_drv_mutex to be held! */ | 63 | /* requires cfg80211_mutex to be held! */ |
59 | static struct cfg80211_registered_device * | 64 | static struct cfg80211_registered_device * |
60 | __cfg80211_drv_from_info(struct genl_info *info) | 65 | __cfg80211_drv_from_info(struct genl_info *info) |
61 | { | 66 | { |
@@ -102,7 +107,7 @@ cfg80211_get_dev_from_info(struct genl_info *info) | |||
102 | { | 107 | { |
103 | struct cfg80211_registered_device *drv; | 108 | struct cfg80211_registered_device *drv; |
104 | 109 | ||
105 | mutex_lock(&cfg80211_drv_mutex); | 110 | mutex_lock(&cfg80211_mutex); |
106 | drv = __cfg80211_drv_from_info(info); | 111 | drv = __cfg80211_drv_from_info(info); |
107 | 112 | ||
108 | /* if it is not an error we grab the lock on | 113 | /* if it is not an error we grab the lock on |
@@ -111,7 +116,7 @@ cfg80211_get_dev_from_info(struct genl_info *info) | |||
111 | if (!IS_ERR(drv)) | 116 | if (!IS_ERR(drv)) |
112 | mutex_lock(&drv->mtx); | 117 | mutex_lock(&drv->mtx); |
113 | 118 | ||
114 | mutex_unlock(&cfg80211_drv_mutex); | 119 | mutex_unlock(&cfg80211_mutex); |
115 | 120 | ||
116 | return drv; | 121 | return drv; |
117 | } | 122 | } |
@@ -122,7 +127,7 @@ cfg80211_get_dev_from_ifindex(int ifindex) | |||
122 | struct cfg80211_registered_device *drv = ERR_PTR(-ENODEV); | 127 | struct cfg80211_registered_device *drv = ERR_PTR(-ENODEV); |
123 | struct net_device *dev; | 128 | struct net_device *dev; |
124 | 129 | ||
125 | mutex_lock(&cfg80211_drv_mutex); | 130 | mutex_lock(&cfg80211_mutex); |
126 | dev = dev_get_by_index(&init_net, ifindex); | 131 | dev = dev_get_by_index(&init_net, ifindex); |
127 | if (!dev) | 132 | if (!dev) |
128 | goto out; | 133 | goto out; |
@@ -133,7 +138,7 @@ cfg80211_get_dev_from_ifindex(int ifindex) | |||
133 | drv = ERR_PTR(-ENODEV); | 138 | drv = ERR_PTR(-ENODEV); |
134 | dev_put(dev); | 139 | dev_put(dev); |
135 | out: | 140 | out: |
136 | mutex_unlock(&cfg80211_drv_mutex); | 141 | mutex_unlock(&cfg80211_mutex); |
137 | return drv; | 142 | return drv; |
138 | } | 143 | } |
139 | 144 | ||
@@ -149,7 +154,7 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, | |||
149 | struct cfg80211_registered_device *drv; | 154 | struct cfg80211_registered_device *drv; |
150 | int wiphy_idx, taken = -1, result, digits; | 155 | int wiphy_idx, taken = -1, result, digits; |
151 | 156 | ||
152 | mutex_lock(&cfg80211_drv_mutex); | 157 | mutex_lock(&cfg80211_mutex); |
153 | 158 | ||
154 | /* prohibit calling the thing phy%d when %d is not its number */ | 159 | /* prohibit calling the thing phy%d when %d is not its number */ |
155 | sscanf(newname, PHY_NAME "%d%n", &wiphy_idx, &taken); | 160 | sscanf(newname, PHY_NAME "%d%n", &wiphy_idx, &taken); |
@@ -197,7 +202,7 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, | |||
197 | 202 | ||
198 | result = 0; | 203 | result = 0; |
199 | out_unlock: | 204 | out_unlock: |
200 | mutex_unlock(&cfg80211_drv_mutex); | 205 | mutex_unlock(&cfg80211_mutex); |
201 | if (result == 0) | 206 | if (result == 0) |
202 | nl80211_notify_dev_rename(rdev); | 207 | nl80211_notify_dev_rename(rdev); |
203 | 208 | ||
@@ -224,19 +229,19 @@ struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv) | |||
224 | 229 | ||
225 | drv->ops = ops; | 230 | drv->ops = ops; |
226 | 231 | ||
227 | mutex_lock(&cfg80211_drv_mutex); | 232 | mutex_lock(&cfg80211_mutex); |
228 | 233 | ||
229 | drv->wiphy_idx = wiphy_counter++; | 234 | drv->wiphy_idx = wiphy_counter++; |
230 | 235 | ||
231 | if (unlikely(!wiphy_idx_valid(drv->wiphy_idx))) { | 236 | if (unlikely(!wiphy_idx_valid(drv->wiphy_idx))) { |
232 | wiphy_counter--; | 237 | wiphy_counter--; |
233 | mutex_unlock(&cfg80211_drv_mutex); | 238 | mutex_unlock(&cfg80211_mutex); |
234 | /* ugh, wrapped! */ | 239 | /* ugh, wrapped! */ |
235 | kfree(drv); | 240 | kfree(drv); |
236 | return NULL; | 241 | return NULL; |
237 | } | 242 | } |
238 | 243 | ||
239 | mutex_unlock(&cfg80211_drv_mutex); | 244 | mutex_unlock(&cfg80211_mutex); |
240 | 245 | ||
241 | /* give it a proper name */ | 246 | /* give it a proper name */ |
242 | dev_set_name(&drv->wiphy.dev, PHY_NAME "%d", drv->wiphy_idx); | 247 | dev_set_name(&drv->wiphy.dev, PHY_NAME "%d", drv->wiphy_idx); |
@@ -314,7 +319,7 @@ int wiphy_register(struct wiphy *wiphy) | |||
314 | /* check and set up bitrates */ | 319 | /* check and set up bitrates */ |
315 | ieee80211_set_bitrate_flags(wiphy); | 320 | ieee80211_set_bitrate_flags(wiphy); |
316 | 321 | ||
317 | mutex_lock(&cfg80211_drv_mutex); | 322 | mutex_lock(&cfg80211_mutex); |
318 | 323 | ||
319 | /* set up regulatory info */ | 324 | /* set up regulatory info */ |
320 | wiphy_update_regulatory(wiphy, REGDOM_SET_BY_CORE); | 325 | wiphy_update_regulatory(wiphy, REGDOM_SET_BY_CORE); |
@@ -334,7 +339,7 @@ int wiphy_register(struct wiphy *wiphy) | |||
334 | 339 | ||
335 | res = 0; | 340 | res = 0; |
336 | out_unlock: | 341 | out_unlock: |
337 | mutex_unlock(&cfg80211_drv_mutex); | 342 | mutex_unlock(&cfg80211_mutex); |
338 | return res; | 343 | return res; |
339 | } | 344 | } |
340 | EXPORT_SYMBOL(wiphy_register); | 345 | EXPORT_SYMBOL(wiphy_register); |
@@ -344,7 +349,7 @@ void wiphy_unregister(struct wiphy *wiphy) | |||
344 | struct cfg80211_registered_device *drv = wiphy_to_dev(wiphy); | 349 | struct cfg80211_registered_device *drv = wiphy_to_dev(wiphy); |
345 | 350 | ||
346 | /* protect the device list */ | 351 | /* protect the device list */ |
347 | mutex_lock(&cfg80211_drv_mutex); | 352 | mutex_lock(&cfg80211_mutex); |
348 | 353 | ||
349 | BUG_ON(!list_empty(&drv->netdev_list)); | 354 | BUG_ON(!list_empty(&drv->netdev_list)); |
350 | 355 | ||
@@ -370,7 +375,7 @@ void wiphy_unregister(struct wiphy *wiphy) | |||
370 | device_del(&drv->wiphy.dev); | 375 | device_del(&drv->wiphy.dev); |
371 | debugfs_remove(drv->wiphy.debugfsdir); | 376 | debugfs_remove(drv->wiphy.debugfsdir); |
372 | 377 | ||
373 | mutex_unlock(&cfg80211_drv_mutex); | 378 | mutex_unlock(&cfg80211_mutex); |
374 | } | 379 | } |
375 | EXPORT_SYMBOL(wiphy_unregister); | 380 | EXPORT_SYMBOL(wiphy_unregister); |
376 | 381 | ||