aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/core.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-06 21:56:12 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:02:33 -0400
commit79c97e97aed7f760d2826c7daf2d42d8eefe9838 (patch)
treebf6d18d0de2c0168a292f05eb6f7296c15278b8b /net/wireless/core.c
parent667503ddcb96f3b10211f997fe55907fa7509841 (diff)
cfg80211: clean up naming once and for all
We've named the registered devices 'drv' sometimes, thinking of "driver", which is not what it is, it's the internal representation of a wiphy, i.e. a device. Let's clean up the naming once and and use 'rdev' aka 'registered device' everywhere. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/core.c')
-rw-r--r--net/wireless/core.c228
1 files changed, 114 insertions, 114 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 9c73769440a8..b5e2f6dfa333 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -30,10 +30,10 @@ MODULE_DESCRIPTION("wireless configuration support");
30/* RCU might be appropriate here since we usually 30/* RCU might be appropriate here since we usually
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 */
33LIST_HEAD(cfg80211_drv_list); 33LIST_HEAD(cfg80211_rdev_list);
34 34
35/* 35/*
36 * This is used to protect the cfg80211_drv_list, cfg80211_regdomain, 36 * This is used to protect the cfg80211_rdev_list, cfg80211_regdomain,
37 * country_ie_regdomain, the reg_beacon_list and the the last regulatory 37 * country_ie_regdomain, the reg_beacon_list and the the last regulatory
38 * request receipt (last_request). 38 * request receipt (last_request).
39 */ 39 */
@@ -43,18 +43,18 @@ DEFINE_MUTEX(cfg80211_mutex);
43static struct dentry *ieee80211_debugfs_dir; 43static struct dentry *ieee80211_debugfs_dir;
44 44
45/* requires cfg80211_mutex to be held! */ 45/* requires cfg80211_mutex to be held! */
46struct cfg80211_registered_device *cfg80211_drv_by_wiphy_idx(int wiphy_idx) 46struct cfg80211_registered_device *cfg80211_rdev_by_wiphy_idx(int wiphy_idx)
47{ 47{
48 struct cfg80211_registered_device *result = NULL, *drv; 48 struct cfg80211_registered_device *result = NULL, *rdev;
49 49
50 if (!wiphy_idx_valid(wiphy_idx)) 50 if (!wiphy_idx_valid(wiphy_idx))
51 return NULL; 51 return NULL;
52 52
53 assert_cfg80211_lock(); 53 assert_cfg80211_lock();
54 54
55 list_for_each_entry(drv, &cfg80211_drv_list, list) { 55 list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
56 if (drv->wiphy_idx == wiphy_idx) { 56 if (rdev->wiphy_idx == wiphy_idx) {
57 result = drv; 57 result = rdev;
58 break; 58 break;
59 } 59 }
60 } 60 }
@@ -64,32 +64,32 @@ struct cfg80211_registered_device *cfg80211_drv_by_wiphy_idx(int wiphy_idx)
64 64
65int get_wiphy_idx(struct wiphy *wiphy) 65int get_wiphy_idx(struct wiphy *wiphy)
66{ 66{
67 struct cfg80211_registered_device *drv; 67 struct cfg80211_registered_device *rdev;
68 if (!wiphy) 68 if (!wiphy)
69 return WIPHY_IDX_STALE; 69 return WIPHY_IDX_STALE;
70 drv = wiphy_to_dev(wiphy); 70 rdev = wiphy_to_dev(wiphy);
71 return drv->wiphy_idx; 71 return rdev->wiphy_idx;
72} 72}
73 73
74/* requires cfg80211_drv_mutex to be held! */ 74/* requires cfg80211_rdev_mutex to be held! */
75struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx) 75struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx)
76{ 76{
77 struct cfg80211_registered_device *drv; 77 struct cfg80211_registered_device *rdev;
78 78
79 if (!wiphy_idx_valid(wiphy_idx)) 79 if (!wiphy_idx_valid(wiphy_idx))
80 return NULL; 80 return NULL;
81 81
82 assert_cfg80211_lock(); 82 assert_cfg80211_lock();
83 83
84 drv = cfg80211_drv_by_wiphy_idx(wiphy_idx); 84 rdev = cfg80211_rdev_by_wiphy_idx(wiphy_idx);
85 if (!drv) 85 if (!rdev)
86 return NULL; 86 return NULL;
87 return &drv->wiphy; 87 return &rdev->wiphy;
88} 88}
89 89
90/* requires cfg80211_mutex to be held! */ 90/* requires cfg80211_mutex to be held! */
91struct cfg80211_registered_device * 91struct cfg80211_registered_device *
92__cfg80211_drv_from_info(struct genl_info *info) 92__cfg80211_rdev_from_info(struct genl_info *info)
93{ 93{
94 int ifindex; 94 int ifindex;
95 struct cfg80211_registered_device *bywiphyidx = NULL, *byifidx = NULL; 95 struct cfg80211_registered_device *bywiphyidx = NULL, *byifidx = NULL;
@@ -99,7 +99,7 @@ __cfg80211_drv_from_info(struct genl_info *info)
99 assert_cfg80211_lock(); 99 assert_cfg80211_lock();
100 100
101 if (info->attrs[NL80211_ATTR_WIPHY]) { 101 if (info->attrs[NL80211_ATTR_WIPHY]) {
102 bywiphyidx = cfg80211_drv_by_wiphy_idx( 102 bywiphyidx = cfg80211_rdev_by_wiphy_idx(
103 nla_get_u32(info->attrs[NL80211_ATTR_WIPHY])); 103 nla_get_u32(info->attrs[NL80211_ATTR_WIPHY]));
104 err = -ENODEV; 104 err = -ENODEV;
105 } 105 }
@@ -134,26 +134,26 @@ __cfg80211_drv_from_info(struct genl_info *info)
134struct cfg80211_registered_device * 134struct cfg80211_registered_device *
135cfg80211_get_dev_from_info(struct genl_info *info) 135cfg80211_get_dev_from_info(struct genl_info *info)
136{ 136{
137 struct cfg80211_registered_device *drv; 137 struct cfg80211_registered_device *rdev;
138 138
139 mutex_lock(&cfg80211_mutex); 139 mutex_lock(&cfg80211_mutex);
140 drv = __cfg80211_drv_from_info(info); 140 rdev = __cfg80211_rdev_from_info(info);
141 141
142 /* if it is not an error we grab the lock on 142 /* if it is not an error we grab the lock on
143 * it to assure it won't be going away while 143 * it to assure it won't be going away while
144 * we operate on it */ 144 * we operate on it */
145 if (!IS_ERR(drv)) 145 if (!IS_ERR(rdev))
146 mutex_lock(&drv->mtx); 146 mutex_lock(&rdev->mtx);
147 147
148 mutex_unlock(&cfg80211_mutex); 148 mutex_unlock(&cfg80211_mutex);
149 149
150 return drv; 150 return rdev;
151} 151}
152 152
153struct cfg80211_registered_device * 153struct cfg80211_registered_device *
154cfg80211_get_dev_from_ifindex(int ifindex) 154cfg80211_get_dev_from_ifindex(int ifindex)
155{ 155{
156 struct cfg80211_registered_device *drv = ERR_PTR(-ENODEV); 156 struct cfg80211_registered_device *rdev = ERR_PTR(-ENODEV);
157 struct net_device *dev; 157 struct net_device *dev;
158 158
159 mutex_lock(&cfg80211_mutex); 159 mutex_lock(&cfg80211_mutex);
@@ -161,21 +161,21 @@ cfg80211_get_dev_from_ifindex(int ifindex)
161 if (!dev) 161 if (!dev)
162 goto out; 162 goto out;
163 if (dev->ieee80211_ptr) { 163 if (dev->ieee80211_ptr) {
164 drv = wiphy_to_dev(dev->ieee80211_ptr->wiphy); 164 rdev = wiphy_to_dev(dev->ieee80211_ptr->wiphy);
165 mutex_lock(&drv->mtx); 165 mutex_lock(&rdev->mtx);
166 } else 166 } else
167 drv = ERR_PTR(-ENODEV); 167 rdev = ERR_PTR(-ENODEV);
168 dev_put(dev); 168 dev_put(dev);
169 out: 169 out:
170 mutex_unlock(&cfg80211_mutex); 170 mutex_unlock(&cfg80211_mutex);
171 return drv; 171 return rdev;
172} 172}
173 173
174/* requires cfg80211_mutex to be held */ 174/* requires cfg80211_mutex to be held */
175int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, 175int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
176 char *newname) 176 char *newname)
177{ 177{
178 struct cfg80211_registered_device *drv; 178 struct cfg80211_registered_device *rdev2;
179 int wiphy_idx, taken = -1, result, digits; 179 int wiphy_idx, taken = -1, result, digits;
180 180
181 assert_cfg80211_lock(); 181 assert_cfg80211_lock();
@@ -201,8 +201,8 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
201 return 0; 201 return 0;
202 202
203 /* Ensure another device does not already have this name. */ 203 /* Ensure another device does not already have this name. */
204 list_for_each_entry(drv, &cfg80211_drv_list, list) 204 list_for_each_entry(rdev2, &cfg80211_rdev_list, list)
205 if (strcmp(newname, dev_name(&drv->wiphy.dev)) == 0) 205 if (strcmp(newname, dev_name(&rdev2->wiphy.dev)) == 0)
206 return -EINVAL; 206 return -EINVAL;
207 207
208 result = device_rename(&rdev->wiphy.dev, newname); 208 result = device_rename(&rdev->wiphy.dev, newname);
@@ -224,26 +224,26 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
224 224
225static void cfg80211_rfkill_poll(struct rfkill *rfkill, void *data) 225static void cfg80211_rfkill_poll(struct rfkill *rfkill, void *data)
226{ 226{
227 struct cfg80211_registered_device *drv = data; 227 struct cfg80211_registered_device *rdev = data;
228 228
229 drv->ops->rfkill_poll(&drv->wiphy); 229 rdev->ops->rfkill_poll(&rdev->wiphy);
230} 230}
231 231
232static int cfg80211_rfkill_set_block(void *data, bool blocked) 232static int cfg80211_rfkill_set_block(void *data, bool blocked)
233{ 233{
234 struct cfg80211_registered_device *drv = data; 234 struct cfg80211_registered_device *rdev = data;
235 struct wireless_dev *wdev; 235 struct wireless_dev *wdev;
236 236
237 if (!blocked) 237 if (!blocked)
238 return 0; 238 return 0;
239 239
240 rtnl_lock(); 240 rtnl_lock();
241 mutex_lock(&drv->devlist_mtx); 241 mutex_lock(&rdev->devlist_mtx);
242 242
243 list_for_each_entry(wdev, &drv->netdev_list, list) 243 list_for_each_entry(wdev, &rdev->netdev_list, list)
244 dev_close(wdev->netdev); 244 dev_close(wdev->netdev);
245 245
246 mutex_unlock(&drv->devlist_mtx); 246 mutex_unlock(&rdev->devlist_mtx);
247 rtnl_unlock(); 247 rtnl_unlock();
248 248
249 return 0; 249 return 0;
@@ -251,10 +251,10 @@ static int cfg80211_rfkill_set_block(void *data, bool blocked)
251 251
252static void cfg80211_rfkill_sync_work(struct work_struct *work) 252static void cfg80211_rfkill_sync_work(struct work_struct *work)
253{ 253{
254 struct cfg80211_registered_device *drv; 254 struct cfg80211_registered_device *rdev;
255 255
256 drv = container_of(work, struct cfg80211_registered_device, rfkill_sync); 256 rdev = container_of(work, struct cfg80211_registered_device, rfkill_sync);
257 cfg80211_rfkill_set_block(drv, rfkill_blocked(drv->rfkill)); 257 cfg80211_rfkill_set_block(rdev, rfkill_blocked(rdev->rfkill));
258} 258}
259 259
260static void cfg80211_process_events(struct wireless_dev *wdev) 260static void cfg80211_process_events(struct wireless_dev *wdev)
@@ -328,79 +328,79 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
328{ 328{
329 static int wiphy_counter; 329 static int wiphy_counter;
330 330
331 struct cfg80211_registered_device *drv; 331 struct cfg80211_registered_device *rdev;
332 int alloc_size; 332 int alloc_size;
333 333
334 WARN_ON(!ops->add_key && ops->del_key); 334 WARN_ON(!ops->add_key && ops->del_key);
335 WARN_ON(ops->add_key && !ops->del_key); 335 WARN_ON(ops->add_key && !ops->del_key);
336 336
337 alloc_size = sizeof(*drv) + sizeof_priv; 337 alloc_size = sizeof(*rdev) + sizeof_priv;
338 338
339 drv = kzalloc(alloc_size, GFP_KERNEL); 339 rdev = kzalloc(alloc_size, GFP_KERNEL);
340 if (!drv) 340 if (!rdev)
341 return NULL; 341 return NULL;
342 342
343 drv->ops = ops; 343 rdev->ops = ops;
344 344
345 mutex_lock(&cfg80211_mutex); 345 mutex_lock(&cfg80211_mutex);
346 346
347 drv->wiphy_idx = wiphy_counter++; 347 rdev->wiphy_idx = wiphy_counter++;
348 348
349 if (unlikely(!wiphy_idx_valid(drv->wiphy_idx))) { 349 if (unlikely(!wiphy_idx_valid(rdev->wiphy_idx))) {
350 wiphy_counter--; 350 wiphy_counter--;
351 mutex_unlock(&cfg80211_mutex); 351 mutex_unlock(&cfg80211_mutex);
352 /* ugh, wrapped! */ 352 /* ugh, wrapped! */
353 kfree(drv); 353 kfree(rdev);
354 return NULL; 354 return NULL;
355 } 355 }
356 356
357 mutex_unlock(&cfg80211_mutex); 357 mutex_unlock(&cfg80211_mutex);
358 358
359 /* give it a proper name */ 359 /* give it a proper name */
360 dev_set_name(&drv->wiphy.dev, PHY_NAME "%d", drv->wiphy_idx); 360 dev_set_name(&rdev->wiphy.dev, PHY_NAME "%d", rdev->wiphy_idx);
361 361
362 mutex_init(&drv->mtx); 362 mutex_init(&rdev->mtx);
363 mutex_init(&drv->devlist_mtx); 363 mutex_init(&rdev->devlist_mtx);
364 INIT_LIST_HEAD(&drv->netdev_list); 364 INIT_LIST_HEAD(&rdev->netdev_list);
365 spin_lock_init(&drv->bss_lock); 365 spin_lock_init(&rdev->bss_lock);
366 INIT_LIST_HEAD(&drv->bss_list); 366 INIT_LIST_HEAD(&rdev->bss_list);
367 INIT_WORK(&drv->scan_done_wk, __cfg80211_scan_done); 367 INIT_WORK(&rdev->scan_done_wk, __cfg80211_scan_done);
368 368
369 device_initialize(&drv->wiphy.dev); 369 device_initialize(&rdev->wiphy.dev);
370 drv->wiphy.dev.class = &ieee80211_class; 370 rdev->wiphy.dev.class = &ieee80211_class;
371 drv->wiphy.dev.platform_data = drv; 371 rdev->wiphy.dev.platform_data = rdev;
372 372
373 drv->rfkill_ops.set_block = cfg80211_rfkill_set_block; 373 rdev->rfkill_ops.set_block = cfg80211_rfkill_set_block;
374 drv->rfkill = rfkill_alloc(dev_name(&drv->wiphy.dev), 374 rdev->rfkill = rfkill_alloc(dev_name(&rdev->wiphy.dev),
375 &drv->wiphy.dev, RFKILL_TYPE_WLAN, 375 &rdev->wiphy.dev, RFKILL_TYPE_WLAN,
376 &drv->rfkill_ops, drv); 376 &rdev->rfkill_ops, rdev);
377 377
378 if (!drv->rfkill) { 378 if (!rdev->rfkill) {
379 kfree(drv); 379 kfree(rdev);
380 return NULL; 380 return NULL;
381 } 381 }
382 382
383 INIT_WORK(&drv->rfkill_sync, cfg80211_rfkill_sync_work); 383 INIT_WORK(&rdev->rfkill_sync, cfg80211_rfkill_sync_work);
384 INIT_WORK(&drv->conn_work, cfg80211_conn_work); 384 INIT_WORK(&rdev->conn_work, cfg80211_conn_work);
385 INIT_WORK(&drv->event_work, cfg80211_event_work); 385 INIT_WORK(&rdev->event_work, cfg80211_event_work);
386 386
387 /* 387 /*
388 * Initialize wiphy parameters to IEEE 802.11 MIB default values. 388 * Initialize wiphy parameters to IEEE 802.11 MIB default values.
389 * Fragmentation and RTS threshold are disabled by default with the 389 * Fragmentation and RTS threshold are disabled by default with the
390 * special -1 value. 390 * special -1 value.
391 */ 391 */
392 drv->wiphy.retry_short = 7; 392 rdev->wiphy.retry_short = 7;
393 drv->wiphy.retry_long = 4; 393 rdev->wiphy.retry_long = 4;
394 drv->wiphy.frag_threshold = (u32) -1; 394 rdev->wiphy.frag_threshold = (u32) -1;
395 drv->wiphy.rts_threshold = (u32) -1; 395 rdev->wiphy.rts_threshold = (u32) -1;
396 396
397 return &drv->wiphy; 397 return &rdev->wiphy;
398} 398}
399EXPORT_SYMBOL(wiphy_new); 399EXPORT_SYMBOL(wiphy_new);
400 400
401int wiphy_register(struct wiphy *wiphy) 401int wiphy_register(struct wiphy *wiphy)
402{ 402{
403 struct cfg80211_registered_device *drv = wiphy_to_dev(wiphy); 403 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
404 int res; 404 int res;
405 enum ieee80211_band band; 405 enum ieee80211_band band;
406 struct ieee80211_supported_band *sband; 406 struct ieee80211_supported_band *sband;
@@ -454,11 +454,11 @@ int wiphy_register(struct wiphy *wiphy)
454 /* check and set up bitrates */ 454 /* check and set up bitrates */
455 ieee80211_set_bitrate_flags(wiphy); 455 ieee80211_set_bitrate_flags(wiphy);
456 456
457 res = device_add(&drv->wiphy.dev); 457 res = device_add(&rdev->wiphy.dev);
458 if (res) 458 if (res)
459 return res; 459 return res;
460 460
461 res = rfkill_register(drv->rfkill); 461 res = rfkill_register(rdev->rfkill);
462 if (res) 462 if (res)
463 goto out_rm_dev; 463 goto out_rm_dev;
464 464
@@ -467,16 +467,16 @@ int wiphy_register(struct wiphy *wiphy)
467 /* set up regulatory info */ 467 /* set up regulatory info */
468 wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE); 468 wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE);
469 469
470 list_add(&drv->list, &cfg80211_drv_list); 470 list_add(&rdev->list, &cfg80211_rdev_list);
471 471
472 mutex_unlock(&cfg80211_mutex); 472 mutex_unlock(&cfg80211_mutex);
473 473
474 /* add to debugfs */ 474 /* add to debugfs */
475 drv->wiphy.debugfsdir = 475 rdev->wiphy.debugfsdir =
476 debugfs_create_dir(wiphy_name(&drv->wiphy), 476 debugfs_create_dir(wiphy_name(&rdev->wiphy),
477 ieee80211_debugfs_dir); 477 ieee80211_debugfs_dir);
478 if (IS_ERR(drv->wiphy.debugfsdir)) 478 if (IS_ERR(rdev->wiphy.debugfsdir))
479 drv->wiphy.debugfsdir = NULL; 479 rdev->wiphy.debugfsdir = NULL;
480 480
481 if (wiphy->custom_regulatory) { 481 if (wiphy->custom_regulatory) {
482 struct regulatory_request request; 482 struct regulatory_request request;
@@ -489,48 +489,48 @@ int wiphy_register(struct wiphy *wiphy)
489 nl80211_send_reg_change_event(&request); 489 nl80211_send_reg_change_event(&request);
490 } 490 }
491 491
492 cfg80211_debugfs_drv_add(drv); 492 cfg80211_debugfs_rdev_add(rdev);
493 493
494 return 0; 494 return 0;
495 495
496 out_rm_dev: 496 out_rm_dev:
497 device_del(&drv->wiphy.dev); 497 device_del(&rdev->wiphy.dev);
498 return res; 498 return res;
499} 499}
500EXPORT_SYMBOL(wiphy_register); 500EXPORT_SYMBOL(wiphy_register);
501 501
502void wiphy_rfkill_start_polling(struct wiphy *wiphy) 502void wiphy_rfkill_start_polling(struct wiphy *wiphy)
503{ 503{
504 struct cfg80211_registered_device *drv = wiphy_to_dev(wiphy); 504 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
505 505
506 if (!drv->ops->rfkill_poll) 506 if (!rdev->ops->rfkill_poll)
507 return; 507 return;
508 drv->rfkill_ops.poll = cfg80211_rfkill_poll; 508 rdev->rfkill_ops.poll = cfg80211_rfkill_poll;
509 rfkill_resume_polling(drv->rfkill); 509 rfkill_resume_polling(rdev->rfkill);
510} 510}
511EXPORT_SYMBOL(wiphy_rfkill_start_polling); 511EXPORT_SYMBOL(wiphy_rfkill_start_polling);
512 512
513void wiphy_rfkill_stop_polling(struct wiphy *wiphy) 513void wiphy_rfkill_stop_polling(struct wiphy *wiphy)
514{ 514{
515 struct cfg80211_registered_device *drv = wiphy_to_dev(wiphy); 515 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
516 516
517 rfkill_pause_polling(drv->rfkill); 517 rfkill_pause_polling(rdev->rfkill);
518} 518}
519EXPORT_SYMBOL(wiphy_rfkill_stop_polling); 519EXPORT_SYMBOL(wiphy_rfkill_stop_polling);
520 520
521void wiphy_unregister(struct wiphy *wiphy) 521void wiphy_unregister(struct wiphy *wiphy)
522{ 522{
523 struct cfg80211_registered_device *drv = wiphy_to_dev(wiphy); 523 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
524 524
525 rfkill_unregister(drv->rfkill); 525 rfkill_unregister(rdev->rfkill);
526 526
527 /* protect the device list */ 527 /* protect the device list */
528 mutex_lock(&cfg80211_mutex); 528 mutex_lock(&cfg80211_mutex);
529 529
530 BUG_ON(!list_empty(&drv->netdev_list)); 530 BUG_ON(!list_empty(&rdev->netdev_list));
531 531
532 /* 532 /*
533 * Try to grab drv->mtx. If a command is still in progress, 533 * Try to grab rdev->mtx. If a command is still in progress,
534 * hopefully the driver will refuse it since it's tearing 534 * hopefully the driver will refuse it since it's tearing
535 * down the device already. We wait for this command to complete 535 * down the device already. We wait for this command to complete
536 * before unlinking the item from the list. 536 * before unlinking the item from the list.
@@ -539,38 +539,38 @@ void wiphy_unregister(struct wiphy *wiphy)
539 * get to lock contention here if userspace issues a command 539 * get to lock contention here if userspace issues a command
540 * that identified the hardware by wiphy index. 540 * that identified the hardware by wiphy index.
541 */ 541 */
542 mutex_lock(&drv->mtx); 542 mutex_lock(&rdev->mtx);
543 /* unlock again before freeing */ 543 /* unlock again before freeing */
544 mutex_unlock(&drv->mtx); 544 mutex_unlock(&rdev->mtx);
545 545
546 cancel_work_sync(&drv->conn_work); 546 cancel_work_sync(&rdev->conn_work);
547 cancel_work_sync(&drv->scan_done_wk); 547 cancel_work_sync(&rdev->scan_done_wk);
548 kfree(drv->scan_req); 548 kfree(rdev->scan_req);
549 flush_work(&drv->event_work); 549 flush_work(&rdev->event_work);
550 550
551 cfg80211_debugfs_drv_del(drv); 551 cfg80211_debugfs_rdev_del(rdev);
552 552
553 /* If this device got a regulatory hint tell core its 553 /* If this device got a regulatory hint tell core its
554 * free to listen now to a new shiny device regulatory hint */ 554 * free to listen now to a new shiny device regulatory hint */
555 reg_device_remove(wiphy); 555 reg_device_remove(wiphy);
556 556
557 list_del(&drv->list); 557 list_del(&rdev->list);
558 device_del(&drv->wiphy.dev); 558 device_del(&rdev->wiphy.dev);
559 debugfs_remove(drv->wiphy.debugfsdir); 559 debugfs_remove(rdev->wiphy.debugfsdir);
560 560
561 mutex_unlock(&cfg80211_mutex); 561 mutex_unlock(&cfg80211_mutex);
562} 562}
563EXPORT_SYMBOL(wiphy_unregister); 563EXPORT_SYMBOL(wiphy_unregister);
564 564
565void cfg80211_dev_free(struct cfg80211_registered_device *drv) 565void cfg80211_dev_free(struct cfg80211_registered_device *rdev)
566{ 566{
567 struct cfg80211_internal_bss *scan, *tmp; 567 struct cfg80211_internal_bss *scan, *tmp;
568 rfkill_destroy(drv->rfkill); 568 rfkill_destroy(rdev->rfkill);
569 mutex_destroy(&drv->mtx); 569 mutex_destroy(&rdev->mtx);
570 mutex_destroy(&drv->devlist_mtx); 570 mutex_destroy(&rdev->devlist_mtx);
571 list_for_each_entry_safe(scan, tmp, &drv->bss_list, list) 571 list_for_each_entry_safe(scan, tmp, &rdev->bss_list, list)
572 cfg80211_put_bss(&scan->pub); 572 cfg80211_put_bss(&scan->pub);
573 kfree(drv); 573 kfree(rdev);
574} 574}
575 575
576void wiphy_free(struct wiphy *wiphy) 576void wiphy_free(struct wiphy *wiphy)
@@ -581,10 +581,10 @@ EXPORT_SYMBOL(wiphy_free);
581 581
582void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked) 582void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)
583{ 583{
584 struct cfg80211_registered_device *drv = wiphy_to_dev(wiphy); 584 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
585 585
586 if (rfkill_set_hw_state(drv->rfkill, blocked)) 586 if (rfkill_set_hw_state(rdev->rfkill, blocked))
587 schedule_work(&drv->rfkill_sync); 587 schedule_work(&rdev->rfkill_sync);
588} 588}
589EXPORT_SYMBOL(wiphy_rfkill_set_hw_state); 589EXPORT_SYMBOL(wiphy_rfkill_set_hw_state);
590 590