core.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. /*
  2. * This is the linux wireless configuration interface.
  3. *
  4. * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net>
  5. */
  6. #include <linux/if.h>
  7. #include <linux/module.h>
  8. #include <linux/err.h>
  9. #include <linux/list.h>
  10. #include <linux/nl80211.h>
  11. #include <linux/debugfs.h>
  12. #include <linux/notifier.h>
  13. #include <linux/device.h>
  14. #include <linux/rtnetlink.h>
  15. #include <net/genetlink.h>
  16. #include <net/cfg80211.h>
  17. #include "nl80211.h"
  18. #include "core.h"
  19. #include "sysfs.h"
  20. #include "debugfs.h"
  21. /* name for sysfs, %d is appended */
  22. #define PHY_NAME "phy"
  23. MODULE_AUTHOR("Johannes Berg");
  24. MODULE_LICENSE("GPL");
  25. MODULE_DESCRIPTION("wireless configuration support");
  26. /* RCU might be appropriate here since we usually
  27. * only read the list, and that can happen quite
  28. * often because we need to do it for each command */
  29. LIST_HEAD(cfg80211_drv_list);
  30. /*
  31. * This is used to protect the cfg80211_drv_list, cfg80211_regdomain,
  32. * country_ie_regdomain, the reg_beacon_list and the the last regulatory
  33. * request receipt (last_request).
  34. */
  35. DEFINE_MUTEX(cfg80211_mutex);
  36. /* for debugfs */
  37. static struct dentry *ieee80211_debugfs_dir;
  38. /* requires cfg80211_mutex to be held! */
  39. struct cfg80211_registered_device *cfg80211_drv_by_wiphy_idx(int wiphy_idx)
  40. {
  41. struct cfg80211_registered_device *result = NULL, *drv;
  42. if (!wiphy_idx_valid(wiphy_idx))
  43. return NULL;
  44. assert_cfg80211_lock();
  45. list_for_each_entry(drv, &cfg80211_drv_list, list) {
  46. if (drv->wiphy_idx == wiphy_idx) {
  47. result = drv;
  48. break;
  49. }
  50. }
  51. return result;
  52. }
  53. int get_wiphy_idx(struct wiphy *wiphy)
  54. {
  55. struct cfg80211_registered_device *drv;
  56. if (!wiphy)
  57. return WIPHY_IDX_STALE;
  58. drv = wiphy_to_dev(wiphy);
  59. return drv->wiphy_idx;
  60. }
  61. /* requires cfg80211_drv_mutex to be held! */
  62. struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx)
  63. {
  64. struct cfg80211_registered_device *drv;
  65. if (!wiphy_idx_valid(wiphy_idx))
  66. return NULL;
  67. assert_cfg80211_lock();
  68. drv = cfg80211_drv_by_wiphy_idx(wiphy_idx);
  69. if (!drv)
  70. return NULL;
  71. return &drv->wiphy;
  72. }
  73. /* requires cfg80211_mutex to be held! */
  74. struct cfg80211_registered_device *
  75. __cfg80211_drv_from_info(struct genl_info *info)
  76. {
  77. int ifindex;
  78. struct cfg80211_registered_device *bywiphyidx = NULL, *byifidx = NULL;
  79. struct net_device *dev;
  80. int err = -EINVAL;
  81. assert_cfg80211_lock();
  82. if (info->attrs[NL80211_ATTR_WIPHY]) {
  83. bywiphyidx = cfg80211_drv_by_wiphy_idx(
  84. nla_get_u32(info->attrs[NL80211_ATTR_WIPHY]));
  85. err = -ENODEV;
  86. }
  87. if (info->attrs[NL80211_ATTR_IFINDEX]) {
  88. ifindex = nla_get_u32(info->attrs[NL80211_ATTR_IFINDEX]);
  89. dev = dev_get_by_index(&init_net, ifindex);
  90. if (dev) {
  91. if (dev->ieee80211_ptr)
  92. byifidx =
  93. wiphy_to_dev(dev->ieee80211_ptr->wiphy);
  94. dev_put(dev);
  95. }
  96. err = -ENODEV;
  97. }
  98. if (bywiphyidx && byifidx) {
  99. if (bywiphyidx != byifidx)
  100. return ERR_PTR(-EINVAL);
  101. else
  102. return bywiphyidx; /* == byifidx */
  103. }
  104. if (bywiphyidx)
  105. return bywiphyidx;
  106. if (byifidx)
  107. return byifidx;
  108. return ERR_PTR(err);
  109. }
  110. struct cfg80211_registered_device *
  111. cfg80211_get_dev_from_info(struct genl_info *info)
  112. {
  113. struct cfg80211_registered_device *drv;
  114. mutex_lock(&cfg80211_mutex);
  115. drv = __cfg80211_drv_from_info(info);
  116. /* if it is not an error we grab the lock on
  117. * it to assure it won't be going away while
  118. * we operate on it */
  119. if (!IS_ERR(drv))
  120. mutex_lock(&drv->mtx);
  121. mutex_unlock(&cfg80211_mutex);
  122. return drv;
  123. }
  124. struct cfg80211_registered_device *
  125. cfg80211_get_dev_from_ifindex(int ifindex)
  126. {
  127. struct cfg80211_registered_device *drv = ERR_PTR(-ENODEV);
  128. struct net_device *dev;
  129. mutex_lock(&cfg80211_mutex);
  130. dev = dev_get_by_index(&init_net, ifindex);
  131. if (!dev)
  132. goto out;
  133. if (dev->ieee80211_ptr) {
  134. drv = wiphy_to_dev(dev->ieee80211_ptr->wiphy);
  135. mutex_lock(&drv->mtx);
  136. } else
  137. drv = ERR_PTR(-ENODEV);
  138. dev_put(dev);
  139. out:
  140. mutex_unlock(&cfg80211_mutex);
  141. return drv;
  142. }
  143. /* requires cfg80211_mutex to be held */
  144. int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
  145. char *newname)
  146. {
  147. struct cfg80211_registered_device *drv;
  148. int wiphy_idx, taken = -1, result, digits;
  149. assert_cfg80211_lock();
  150. /* prohibit calling the thing phy%d when %d is not its number */
  151. sscanf(newname, PHY_NAME "%d%n", &wiphy_idx, &taken);
  152. if (taken == strlen(newname) && wiphy_idx != rdev->wiphy_idx) {
  153. /* count number of places needed to print wiphy_idx */
  154. digits = 1;
  155. while (wiphy_idx /= 10)
  156. digits++;
  157. /*
  158. * deny the name if it is phy<idx> where <idx> is printed
  159. * without leading zeroes. taken == strlen(newname) here
  160. */
  161. if (taken == strlen(PHY_NAME) + digits)
  162. return -EINVAL;
  163. }
  164. /* Ignore nop renames */
  165. if (strcmp(newname, dev_name(&rdev->wiphy.dev)) == 0)
  166. return 0;
  167. /* Ensure another device does not already have this name. */
  168. list_for_each_entry(drv, &cfg80211_drv_list, list)
  169. if (strcmp(newname, dev_name(&drv->wiphy.dev)) == 0)
  170. return -EINVAL;
  171. result = device_rename(&rdev->wiphy.dev, newname);
  172. if (result)
  173. return result;
  174. if (rdev->wiphy.debugfsdir &&
  175. !debugfs_rename(rdev->wiphy.debugfsdir->d_parent,
  176. rdev->wiphy.debugfsdir,
  177. rdev->wiphy.debugfsdir->d_parent,
  178. newname))
  179. printk(KERN_ERR "cfg80211: failed to rename debugfs dir to %s!\n",
  180. newname);
  181. nl80211_notify_dev_rename(rdev);
  182. return 0;
  183. }
  184. static void cfg80211_rfkill_poll(struct rfkill *rfkill, void *data)
  185. {
  186. struct cfg80211_registered_device *drv = data;
  187. drv->ops->rfkill_poll(&drv->wiphy);
  188. }
  189. static int cfg80211_rfkill_set_block(void *data, bool blocked)
  190. {
  191. struct cfg80211_registered_device *drv = data;
  192. struct wireless_dev *wdev;
  193. if (!blocked)
  194. return 0;
  195. rtnl_lock();
  196. mutex_lock(&drv->devlist_mtx);
  197. list_for_each_entry(wdev, &drv->netdev_list, list)
  198. dev_close(wdev->netdev);
  199. mutex_unlock(&drv->devlist_mtx);
  200. rtnl_unlock();
  201. return 0;
  202. }
  203. static void cfg80211_rfkill_sync_work(struct work_struct *work)
  204. {
  205. struct cfg80211_registered_device *drv;
  206. drv = container_of(work, struct cfg80211_registered_device, rfkill_sync);
  207. cfg80211_rfkill_set_block(drv, rfkill_blocked(drv->rfkill));
  208. }
  209. /* exported functions */
  210. struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
  211. {
  212. static int wiphy_counter;
  213. struct cfg80211_registered_device *drv;
  214. int alloc_size;
  215. WARN_ON(!ops->add_key && ops->del_key);
  216. WARN_ON(ops->add_key && !ops->del_key);
  217. alloc_size = sizeof(*drv) + sizeof_priv;
  218. drv = kzalloc(alloc_size, GFP_KERNEL);
  219. if (!drv)
  220. return NULL;
  221. drv->ops = ops;
  222. mutex_lock(&cfg80211_mutex);
  223. drv->wiphy_idx = wiphy_counter++;
  224. if (unlikely(!wiphy_idx_valid(drv->wiphy_idx))) {
  225. wiphy_counter--;
  226. mutex_unlock(&cfg80211_mutex);
  227. /* ugh, wrapped! */
  228. kfree(drv);
  229. return NULL;
  230. }
  231. mutex_unlock(&cfg80211_mutex);
  232. /* give it a proper name */
  233. dev_set_name(&drv->wiphy.dev, PHY_NAME "%d", drv->wiphy_idx);
  234. mutex_init(&drv->mtx);
  235. mutex_init(&drv->devlist_mtx);
  236. INIT_LIST_HEAD(&drv->netdev_list);
  237. spin_lock_init(&drv->bss_lock);
  238. INIT_LIST_HEAD(&drv->bss_list);
  239. device_initialize(&drv->wiphy.dev);
  240. drv->wiphy.dev.class = &ieee80211_class;
  241. drv->wiphy.dev.platform_data = drv;
  242. drv->rfkill_ops.set_block = cfg80211_rfkill_set_block;
  243. drv->rfkill = rfkill_alloc(dev_name(&drv->wiphy.dev),
  244. &drv->wiphy.dev, RFKILL_TYPE_WLAN,
  245. &drv->rfkill_ops, drv);
  246. if (!drv->rfkill) {
  247. kfree(drv);
  248. return NULL;
  249. }
  250. INIT_WORK(&drv->rfkill_sync, cfg80211_rfkill_sync_work);
  251. INIT_WORK(&drv->conn_work, cfg80211_conn_work);
  252. /*
  253. * Initialize wiphy parameters to IEEE 802.11 MIB default values.
  254. * Fragmentation and RTS threshold are disabled by default with the
  255. * special -1 value.
  256. */
  257. drv->wiphy.retry_short = 7;
  258. drv->wiphy.retry_long = 4;
  259. drv->wiphy.frag_threshold = (u32) -1;
  260. drv->wiphy.rts_threshold = (u32) -1;
  261. return &drv->wiphy;
  262. }
  263. EXPORT_SYMBOL(wiphy_new);
  264. int wiphy_register(struct wiphy *wiphy)
  265. {
  266. struct cfg80211_registered_device *drv = wiphy_to_dev(wiphy);
  267. int res;
  268. enum ieee80211_band band;
  269. struct ieee80211_supported_band *sband;
  270. bool have_band = false;
  271. int i;
  272. u16 ifmodes = wiphy->interface_modes;
  273. /* sanity check ifmodes */
  274. WARN_ON(!ifmodes);
  275. ifmodes &= ((1 << __NL80211_IFTYPE_AFTER_LAST) - 1) & ~1;
  276. if (WARN_ON(ifmodes != wiphy->interface_modes))
  277. wiphy->interface_modes = ifmodes;
  278. /* sanity check supported bands/channels */
  279. for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
  280. sband = wiphy->bands[band];
  281. if (!sband)
  282. continue;
  283. sband->band = band;
  284. if (WARN_ON(!sband->n_channels || !sband->n_bitrates))
  285. return -EINVAL;
  286. /*
  287. * Since we use a u32 for rate bitmaps in
  288. * ieee80211_get_response_rate, we cannot
  289. * have more than 32 legacy rates.
  290. */
  291. if (WARN_ON(sband->n_bitrates > 32))
  292. return -EINVAL;
  293. for (i = 0; i < sband->n_channels; i++) {
  294. sband->channels[i].orig_flags =
  295. sband->channels[i].flags;
  296. sband->channels[i].orig_mag =
  297. sband->channels[i].max_antenna_gain;
  298. sband->channels[i].orig_mpwr =
  299. sband->channels[i].max_power;
  300. sband->channels[i].band = band;
  301. }
  302. have_band = true;
  303. }
  304. if (!have_band) {
  305. WARN_ON(1);
  306. return -EINVAL;
  307. }
  308. /* check and set up bitrates */
  309. ieee80211_set_bitrate_flags(wiphy);
  310. res = device_add(&drv->wiphy.dev);
  311. if (res)
  312. return res;
  313. res = rfkill_register(drv->rfkill);
  314. if (res)
  315. goto out_rm_dev;
  316. mutex_lock(&cfg80211_mutex);
  317. /* set up regulatory info */
  318. wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE);
  319. list_add(&drv->list, &cfg80211_drv_list);
  320. mutex_unlock(&cfg80211_mutex);
  321. /* add to debugfs */
  322. drv->wiphy.debugfsdir =
  323. debugfs_create_dir(wiphy_name(&drv->wiphy),
  324. ieee80211_debugfs_dir);
  325. if (IS_ERR(drv->wiphy.debugfsdir))
  326. drv->wiphy.debugfsdir = NULL;
  327. if (wiphy->custom_regulatory) {
  328. struct regulatory_request request;
  329. request.wiphy_idx = get_wiphy_idx(wiphy);
  330. request.initiator = NL80211_REGDOM_SET_BY_DRIVER;
  331. request.alpha2[0] = '9';
  332. request.alpha2[1] = '9';
  333. nl80211_send_reg_change_event(&request);
  334. }
  335. cfg80211_debugfs_drv_add(drv);
  336. return 0;
  337. out_rm_dev:
  338. device_del(&drv->wiphy.dev);
  339. return res;
  340. }
  341. EXPORT_SYMBOL(wiphy_register);
  342. void wiphy_rfkill_start_polling(struct wiphy *wiphy)
  343. {
  344. struct cfg80211_registered_device *drv = wiphy_to_dev(wiphy);
  345. if (!drv->ops->rfkill_poll)
  346. return;
  347. drv->rfkill_ops.poll = cfg80211_rfkill_poll;
  348. rfkill_resume_polling(drv->rfkill);
  349. }
  350. EXPORT_SYMBOL(wiphy_rfkill_start_polling);
  351. void wiphy_rfkill_stop_polling(struct wiphy *wiphy)
  352. {
  353. struct cfg80211_registered_device *drv = wiphy_to_dev(wiphy);
  354. rfkill_pause_polling(drv->rfkill);
  355. }
  356. EXPORT_SYMBOL(wiphy_rfkill_stop_polling);
  357. void wiphy_unregister(struct wiphy *wiphy)
  358. {
  359. struct cfg80211_registered_device *drv = wiphy_to_dev(wiphy);
  360. rfkill_unregister(drv->rfkill);
  361. /* protect the device list */
  362. mutex_lock(&cfg80211_mutex);
  363. BUG_ON(!list_empty(&drv->netdev_list));
  364. /*
  365. * Try to grab drv->mtx. If a command is still in progress,
  366. * hopefully the driver will refuse it since it's tearing
  367. * down the device already. We wait for this command to complete
  368. * before unlinking the item from the list.
  369. * Note: as codified by the BUG_ON above we cannot get here if
  370. * a virtual interface is still associated. Hence, we can only
  371. * get to lock contention here if userspace issues a command
  372. * that identified the hardware by wiphy index.
  373. */
  374. mutex_lock(&drv->mtx);
  375. /* unlock again before freeing */
  376. mutex_unlock(&drv->mtx);
  377. cancel_work_sync(&drv->conn_work);
  378. cfg80211_debugfs_drv_del(drv);
  379. /* If this device got a regulatory hint tell core its
  380. * free to listen now to a new shiny device regulatory hint */
  381. reg_device_remove(wiphy);
  382. list_del(&drv->list);
  383. device_del(&drv->wiphy.dev);
  384. debugfs_remove(drv->wiphy.debugfsdir);
  385. mutex_unlock(&cfg80211_mutex);
  386. }
  387. EXPORT_SYMBOL(wiphy_unregister);
  388. void cfg80211_dev_free(struct cfg80211_registered_device *drv)
  389. {
  390. struct cfg80211_internal_bss *scan, *tmp;
  391. rfkill_destroy(drv->rfkill);
  392. mutex_destroy(&drv->mtx);
  393. mutex_destroy(&drv->devlist_mtx);
  394. list_for_each_entry_safe(scan, tmp, &drv->bss_list, list)
  395. cfg80211_put_bss(&scan->pub);
  396. kfree(drv);
  397. }
  398. void wiphy_free(struct wiphy *wiphy)
  399. {
  400. put_device(&wiphy->dev);
  401. }
  402. EXPORT_SYMBOL(wiphy_free);
  403. void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)
  404. {
  405. struct cfg80211_registered_device *drv = wiphy_to_dev(wiphy);
  406. if (rfkill_set_hw_state(drv->rfkill, blocked))
  407. schedule_work(&drv->rfkill_sync);
  408. }
  409. EXPORT_SYMBOL(wiphy_rfkill_set_hw_state);
  410. static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
  411. unsigned long state,
  412. void *ndev)
  413. {
  414. struct net_device *dev = ndev;
  415. struct wireless_dev *wdev = dev->ieee80211_ptr;
  416. struct cfg80211_registered_device *rdev;
  417. if (!wdev)
  418. return NOTIFY_DONE;
  419. rdev = wiphy_to_dev(wdev->wiphy);
  420. WARN_ON(wdev->iftype == NL80211_IFTYPE_UNSPECIFIED);
  421. switch (state) {
  422. case NETDEV_REGISTER:
  423. mutex_lock(&rdev->devlist_mtx);
  424. list_add(&wdev->list, &rdev->netdev_list);
  425. if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj,
  426. "phy80211")) {
  427. printk(KERN_ERR "wireless: failed to add phy80211 "
  428. "symlink to netdev!\n");
  429. }
  430. wdev->netdev = dev;
  431. wdev->sme_state = CFG80211_SME_IDLE;
  432. mutex_unlock(&rdev->devlist_mtx);
  433. #ifdef CONFIG_WIRELESS_EXT
  434. wdev->wext.default_key = -1;
  435. wdev->wext.default_mgmt_key = -1;
  436. wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
  437. wdev->wext.ps = CONFIG_CFG80211_DEFAULT_PS_VALUE;
  438. wdev->wext.ps_timeout = 500;
  439. if (rdev->ops->set_power_mgmt)
  440. if (rdev->ops->set_power_mgmt(wdev->wiphy, dev,
  441. wdev->wext.ps,
  442. wdev->wext.ps_timeout)) {
  443. /* assume this means it's off */
  444. wdev->wext.ps = false;
  445. }
  446. #endif
  447. break;
  448. case NETDEV_GOING_DOWN:
  449. switch (wdev->iftype) {
  450. case NL80211_IFTYPE_ADHOC:
  451. cfg80211_leave_ibss(rdev, dev, true);
  452. break;
  453. case NL80211_IFTYPE_STATION:
  454. #ifdef CONFIG_WIRELESS_EXT
  455. kfree(wdev->wext.ie);
  456. wdev->wext.ie = NULL;
  457. wdev->wext.ie_len = 0;
  458. wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
  459. #endif
  460. cfg80211_disconnect(rdev, dev,
  461. WLAN_REASON_DEAUTH_LEAVING, true);
  462. cfg80211_mlme_down(rdev, dev);
  463. break;
  464. default:
  465. break;
  466. }
  467. break;
  468. case NETDEV_UP:
  469. #ifdef CONFIG_WIRELESS_EXT
  470. switch (wdev->iftype) {
  471. case NL80211_IFTYPE_ADHOC:
  472. if (wdev->wext.ibss.ssid_len)
  473. cfg80211_join_ibss(rdev, dev,
  474. &wdev->wext.ibss);
  475. break;
  476. case NL80211_IFTYPE_STATION:
  477. if (wdev->wext.connect.ssid_len)
  478. cfg80211_connect(rdev, dev,
  479. &wdev->wext.connect);
  480. break;
  481. default:
  482. break;
  483. }
  484. #endif
  485. break;
  486. case NETDEV_UNREGISTER:
  487. mutex_lock(&rdev->devlist_mtx);
  488. if (!list_empty(&wdev->list)) {
  489. sysfs_remove_link(&dev->dev.kobj, "phy80211");
  490. list_del_init(&wdev->list);
  491. }
  492. mutex_unlock(&rdev->devlist_mtx);
  493. break;
  494. case NETDEV_PRE_UP:
  495. if (rfkill_blocked(rdev->rfkill))
  496. return notifier_from_errno(-ERFKILL);
  497. break;
  498. }
  499. return NOTIFY_DONE;
  500. }
  501. static struct notifier_block cfg80211_netdev_notifier = {
  502. .notifier_call = cfg80211_netdev_notifier_call,
  503. };
  504. static int cfg80211_init(void)
  505. {
  506. int err;
  507. err = wiphy_sysfs_init();
  508. if (err)
  509. goto out_fail_sysfs;
  510. err = register_netdevice_notifier(&cfg80211_netdev_notifier);
  511. if (err)
  512. goto out_fail_notifier;
  513. err = nl80211_init();
  514. if (err)
  515. goto out_fail_nl80211;
  516. ieee80211_debugfs_dir = debugfs_create_dir("ieee80211", NULL);
  517. err = regulatory_init();
  518. if (err)
  519. goto out_fail_reg;
  520. return 0;
  521. out_fail_reg:
  522. debugfs_remove(ieee80211_debugfs_dir);
  523. out_fail_nl80211:
  524. unregister_netdevice_notifier(&cfg80211_netdev_notifier);
  525. out_fail_notifier:
  526. wiphy_sysfs_exit();
  527. out_fail_sysfs:
  528. return err;
  529. }
  530. subsys_initcall(cfg80211_init);
  531. static void cfg80211_exit(void)
  532. {
  533. debugfs_remove(ieee80211_debugfs_dir);
  534. nl80211_exit();
  535. unregister_netdevice_notifier(&cfg80211_netdev_notifier);
  536. wiphy_sysfs_exit();
  537. regulatory_exit();
  538. }
  539. module_exit(cfg80211_exit);