main.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. /*
  2. * mac80211 glue code for mac80211 Prism54 drivers
  3. *
  4. * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
  5. * Copyright (c) 2007-2009, Christian Lamparter <chunkeey@web.de>
  6. * Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
  7. *
  8. * Based on:
  9. * - the islsm (softmac prism54) driver, which is:
  10. * Copyright 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al.
  11. * - stlc45xx driver
  12. * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License version 2 as
  16. * published by the Free Software Foundation.
  17. */
  18. #include <linux/init.h>
  19. #include <linux/firmware.h>
  20. #include <linux/etherdevice.h>
  21. #include <net/mac80211.h>
  22. #include "p54.h"
  23. #include "lmac.h"
  24. static int modparam_nohwcrypt;
  25. module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
  26. MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
  27. MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>");
  28. MODULE_DESCRIPTION("Softmac Prism54 common code");
  29. MODULE_LICENSE("GPL");
  30. MODULE_ALIAS("prism54common");
  31. static void p54_sta_notify(struct ieee80211_hw *dev, struct ieee80211_vif *vif,
  32. enum sta_notify_cmd notify_cmd,
  33. struct ieee80211_sta *sta)
  34. {
  35. struct p54_common *priv = dev->priv;
  36. switch (notify_cmd) {
  37. case STA_NOTIFY_ADD:
  38. case STA_NOTIFY_REMOVE:
  39. /*
  40. * Notify the firmware that we don't want or we don't
  41. * need to buffer frames for this station anymore.
  42. */
  43. p54_sta_unlock(priv, sta->addr);
  44. break;
  45. case STA_NOTIFY_AWAKE:
  46. /* update the firmware's filter table */
  47. p54_sta_unlock(priv, sta->addr);
  48. break;
  49. default:
  50. break;
  51. }
  52. }
  53. static int p54_set_tim(struct ieee80211_hw *dev, struct ieee80211_sta *sta,
  54. bool set)
  55. {
  56. struct p54_common *priv = dev->priv;
  57. return p54_update_beacon_tim(priv, sta->aid, set);
  58. }
  59. u8 *p54_find_ie(struct sk_buff *skb, u8 ie)
  60. {
  61. struct ieee80211_mgmt *mgmt = (void *)skb->data;
  62. u8 *pos, *end;
  63. if (skb->len <= sizeof(mgmt))
  64. return NULL;
  65. pos = (u8 *)mgmt->u.beacon.variable;
  66. end = skb->data + skb->len;
  67. while (pos < end) {
  68. if (pos + 2 + pos[1] > end)
  69. return NULL;
  70. if (pos[0] == ie)
  71. return pos;
  72. pos += 2 + pos[1];
  73. }
  74. return NULL;
  75. }
  76. static int p54_beacon_format_ie_tim(struct sk_buff *skb)
  77. {
  78. /*
  79. * the good excuse for this mess is ... the firmware.
  80. * The dummy TIM MUST be at the end of the beacon frame,
  81. * because it'll be overwritten!
  82. */
  83. u8 *tim;
  84. u8 dtim_len;
  85. u8 dtim_period;
  86. u8 *next;
  87. tim = p54_find_ie(skb, WLAN_EID_TIM);
  88. if (!tim)
  89. return 0;
  90. dtim_len = tim[1];
  91. dtim_period = tim[3];
  92. next = tim + 2 + dtim_len;
  93. if (dtim_len < 3)
  94. return -EINVAL;
  95. memmove(tim, next, skb_tail_pointer(skb) - next);
  96. tim = skb_tail_pointer(skb) - (dtim_len + 2);
  97. /* add the dummy at the end */
  98. tim[0] = WLAN_EID_TIM;
  99. tim[1] = 3;
  100. tim[2] = 0;
  101. tim[3] = dtim_period;
  102. tim[4] = 0;
  103. if (dtim_len > 3)
  104. skb_trim(skb, skb->len - (dtim_len - 3));
  105. return 0;
  106. }
  107. static int p54_beacon_update(struct p54_common *priv,
  108. struct ieee80211_vif *vif)
  109. {
  110. struct sk_buff *beacon;
  111. int ret;
  112. beacon = ieee80211_beacon_get(priv->hw, vif);
  113. if (!beacon)
  114. return -ENOMEM;
  115. ret = p54_beacon_format_ie_tim(beacon);
  116. if (ret)
  117. return ret;
  118. /*
  119. * During operation, the firmware takes care of beaconing.
  120. * The driver only needs to upload a new beacon template, once
  121. * the template was changed by the stack or userspace.
  122. *
  123. * LMAC API 3.2.2 also specifies that the driver does not need
  124. * to cancel the old beacon template by hand, instead the firmware
  125. * will release the previous one through the feedback mechanism.
  126. */
  127. WARN_ON(p54_tx_80211(priv->hw, beacon));
  128. priv->tsf_high32 = 0;
  129. priv->tsf_low32 = 0;
  130. return 0;
  131. }
  132. static int p54_start(struct ieee80211_hw *dev)
  133. {
  134. struct p54_common *priv = dev->priv;
  135. int err;
  136. mutex_lock(&priv->conf_mutex);
  137. err = priv->open(dev);
  138. if (err)
  139. goto out;
  140. P54_SET_QUEUE(priv->qos_params[0], 0x0002, 0x0003, 0x0007, 47);
  141. P54_SET_QUEUE(priv->qos_params[1], 0x0002, 0x0007, 0x000f, 94);
  142. P54_SET_QUEUE(priv->qos_params[2], 0x0003, 0x000f, 0x03ff, 0);
  143. P54_SET_QUEUE(priv->qos_params[3], 0x0007, 0x000f, 0x03ff, 0);
  144. err = p54_set_edcf(priv);
  145. if (err)
  146. goto out;
  147. memset(priv->bssid, ~0, ETH_ALEN);
  148. priv->mode = NL80211_IFTYPE_MONITOR;
  149. err = p54_setup_mac(priv);
  150. if (err) {
  151. priv->mode = NL80211_IFTYPE_UNSPECIFIED;
  152. goto out;
  153. }
  154. ieee80211_queue_delayed_work(dev, &priv->work, 0);
  155. priv->softled_state = 0;
  156. err = p54_set_leds(priv);
  157. out:
  158. mutex_unlock(&priv->conf_mutex);
  159. return err;
  160. }
  161. static void p54_stop(struct ieee80211_hw *dev)
  162. {
  163. struct p54_common *priv = dev->priv;
  164. int i;
  165. mutex_lock(&priv->conf_mutex);
  166. priv->mode = NL80211_IFTYPE_UNSPECIFIED;
  167. priv->softled_state = 0;
  168. p54_set_leds(priv);
  169. cancel_delayed_work_sync(&priv->work);
  170. priv->stop(dev);
  171. skb_queue_purge(&priv->tx_pending);
  172. skb_queue_purge(&priv->tx_queue);
  173. for (i = 0; i < P54_QUEUE_NUM; i++) {
  174. priv->tx_stats[i].count = 0;
  175. priv->tx_stats[i].len = 0;
  176. }
  177. priv->beacon_req_id = cpu_to_le32(0);
  178. priv->tsf_high32 = priv->tsf_low32 = 0;
  179. mutex_unlock(&priv->conf_mutex);
  180. }
  181. static int p54_add_interface(struct ieee80211_hw *dev,
  182. struct ieee80211_if_init_conf *conf)
  183. {
  184. struct p54_common *priv = dev->priv;
  185. mutex_lock(&priv->conf_mutex);
  186. if (priv->mode != NL80211_IFTYPE_MONITOR) {
  187. mutex_unlock(&priv->conf_mutex);
  188. return -EOPNOTSUPP;
  189. }
  190. priv->vif = conf->vif;
  191. switch (conf->type) {
  192. case NL80211_IFTYPE_STATION:
  193. case NL80211_IFTYPE_ADHOC:
  194. case NL80211_IFTYPE_AP:
  195. case NL80211_IFTYPE_MESH_POINT:
  196. priv->mode = conf->type;
  197. break;
  198. default:
  199. mutex_unlock(&priv->conf_mutex);
  200. return -EOPNOTSUPP;
  201. }
  202. memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
  203. p54_setup_mac(priv);
  204. mutex_unlock(&priv->conf_mutex);
  205. return 0;
  206. }
  207. static void p54_remove_interface(struct ieee80211_hw *dev,
  208. struct ieee80211_if_init_conf *conf)
  209. {
  210. struct p54_common *priv = dev->priv;
  211. mutex_lock(&priv->conf_mutex);
  212. priv->vif = NULL;
  213. /*
  214. * LMAC API 3.2.2 states that any active beacon template must be
  215. * canceled by the driver before attempting a mode transition.
  216. */
  217. if (le32_to_cpu(priv->beacon_req_id) != 0) {
  218. p54_tx_cancel(priv, priv->beacon_req_id);
  219. wait_for_completion_interruptible_timeout(&priv->beacon_comp, HZ);
  220. }
  221. priv->mode = NL80211_IFTYPE_MONITOR;
  222. memset(priv->mac_addr, 0, ETH_ALEN);
  223. memset(priv->bssid, 0, ETH_ALEN);
  224. p54_setup_mac(priv);
  225. mutex_unlock(&priv->conf_mutex);
  226. }
  227. static int p54_config(struct ieee80211_hw *dev, u32 changed)
  228. {
  229. int ret = 0;
  230. struct p54_common *priv = dev->priv;
  231. struct ieee80211_conf *conf = &dev->conf;
  232. mutex_lock(&priv->conf_mutex);
  233. if (changed & IEEE80211_CONF_CHANGE_POWER)
  234. priv->output_power = conf->power_level << 2;
  235. if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
  236. ret = p54_scan(priv, P54_SCAN_EXIT, 0);
  237. if (ret)
  238. goto out;
  239. }
  240. if (changed & IEEE80211_CONF_CHANGE_PS) {
  241. ret = p54_set_ps(priv);
  242. if (ret)
  243. goto out;
  244. }
  245. if (changed & IEEE80211_CONF_CHANGE_IDLE) {
  246. ret = p54_setup_mac(priv);
  247. if (ret)
  248. goto out;
  249. }
  250. out:
  251. mutex_unlock(&priv->conf_mutex);
  252. return ret;
  253. }
  254. static void p54_configure_filter(struct ieee80211_hw *dev,
  255. unsigned int changed_flags,
  256. unsigned int *total_flags,
  257. u64 multicast)
  258. {
  259. struct p54_common *priv = dev->priv;
  260. *total_flags &= FIF_PROMISC_IN_BSS |
  261. FIF_OTHER_BSS;
  262. priv->filter_flags = *total_flags;
  263. if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS))
  264. p54_setup_mac(priv);
  265. }
  266. static int p54_conf_tx(struct ieee80211_hw *dev, u16 queue,
  267. const struct ieee80211_tx_queue_params *params)
  268. {
  269. struct p54_common *priv = dev->priv;
  270. int ret;
  271. mutex_lock(&priv->conf_mutex);
  272. if (queue < dev->queues) {
  273. P54_SET_QUEUE(priv->qos_params[queue], params->aifs,
  274. params->cw_min, params->cw_max, params->txop);
  275. ret = p54_set_edcf(priv);
  276. } else
  277. ret = -EINVAL;
  278. mutex_unlock(&priv->conf_mutex);
  279. return ret;
  280. }
  281. static void p54_work(struct work_struct *work)
  282. {
  283. struct p54_common *priv = container_of(work, struct p54_common,
  284. work.work);
  285. if (unlikely(priv->mode == NL80211_IFTYPE_UNSPECIFIED))
  286. return ;
  287. /*
  288. * TODO: walk through tx_queue and do the following tasks
  289. * 1. initiate bursts.
  290. * 2. cancel stuck frames / reset the device if necessary.
  291. */
  292. p54_fetch_statistics(priv);
  293. }
  294. static int p54_get_stats(struct ieee80211_hw *dev,
  295. struct ieee80211_low_level_stats *stats)
  296. {
  297. struct p54_common *priv = dev->priv;
  298. memcpy(stats, &priv->stats, sizeof(*stats));
  299. return 0;
  300. }
  301. static int p54_get_tx_stats(struct ieee80211_hw *dev,
  302. struct ieee80211_tx_queue_stats *stats)
  303. {
  304. struct p54_common *priv = dev->priv;
  305. memcpy(stats, &priv->tx_stats[P54_QUEUE_DATA],
  306. sizeof(stats[0]) * dev->queues);
  307. return 0;
  308. }
  309. static void p54_bss_info_changed(struct ieee80211_hw *dev,
  310. struct ieee80211_vif *vif,
  311. struct ieee80211_bss_conf *info,
  312. u32 changed)
  313. {
  314. struct p54_common *priv = dev->priv;
  315. mutex_lock(&priv->conf_mutex);
  316. if (changed & BSS_CHANGED_BSSID) {
  317. memcpy(priv->bssid, info->bssid, ETH_ALEN);
  318. p54_setup_mac(priv);
  319. }
  320. if (changed & BSS_CHANGED_BEACON) {
  321. p54_scan(priv, P54_SCAN_EXIT, 0);
  322. p54_setup_mac(priv);
  323. p54_beacon_update(priv, vif);
  324. p54_set_edcf(priv);
  325. }
  326. if (changed & (BSS_CHANGED_ERP_SLOT | BSS_CHANGED_BEACON)) {
  327. priv->use_short_slot = info->use_short_slot;
  328. p54_set_edcf(priv);
  329. }
  330. if (changed & BSS_CHANGED_BASIC_RATES) {
  331. if (dev->conf.channel->band == IEEE80211_BAND_5GHZ)
  332. priv->basic_rate_mask = (info->basic_rates << 4);
  333. else
  334. priv->basic_rate_mask = info->basic_rates;
  335. p54_setup_mac(priv);
  336. if (priv->fw_var >= 0x500)
  337. p54_scan(priv, P54_SCAN_EXIT, 0);
  338. }
  339. if (changed & BSS_CHANGED_ASSOC) {
  340. if (info->assoc) {
  341. priv->aid = info->aid;
  342. priv->wakeup_timer = info->beacon_int *
  343. info->dtim_period * 5;
  344. p54_setup_mac(priv);
  345. } else {
  346. priv->wakeup_timer = 500;
  347. priv->aid = 0;
  348. }
  349. }
  350. mutex_unlock(&priv->conf_mutex);
  351. }
  352. static int p54_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,
  353. struct ieee80211_vif *vif, struct ieee80211_sta *sta,
  354. struct ieee80211_key_conf *key)
  355. {
  356. struct p54_common *priv = dev->priv;
  357. int slot, ret = 0;
  358. u8 algo = 0;
  359. u8 *addr = NULL;
  360. if (modparam_nohwcrypt)
  361. return -EOPNOTSUPP;
  362. mutex_lock(&priv->conf_mutex);
  363. if (cmd == SET_KEY) {
  364. switch (key->alg) {
  365. case ALG_TKIP:
  366. if (!(priv->privacy_caps & (BR_DESC_PRIV_CAP_MICHAEL |
  367. BR_DESC_PRIV_CAP_TKIP))) {
  368. ret = -EOPNOTSUPP;
  369. goto out_unlock;
  370. }
  371. key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
  372. algo = P54_CRYPTO_TKIPMICHAEL;
  373. break;
  374. case ALG_WEP:
  375. if (!(priv->privacy_caps & BR_DESC_PRIV_CAP_WEP)) {
  376. ret = -EOPNOTSUPP;
  377. goto out_unlock;
  378. }
  379. key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
  380. algo = P54_CRYPTO_WEP;
  381. break;
  382. case ALG_CCMP:
  383. if (!(priv->privacy_caps & BR_DESC_PRIV_CAP_AESCCMP)) {
  384. ret = -EOPNOTSUPP;
  385. goto out_unlock;
  386. }
  387. key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
  388. algo = P54_CRYPTO_AESCCMP;
  389. break;
  390. default:
  391. ret = -EOPNOTSUPP;
  392. goto out_unlock;
  393. }
  394. slot = bitmap_find_free_region(priv->used_rxkeys,
  395. priv->rx_keycache_size, 0);
  396. if (slot < 0) {
  397. /*
  398. * The device supports the choosen algorithm, but the
  399. * firmware does not provide enough key slots to store
  400. * all of them.
  401. * But encryption offload for outgoing frames is always
  402. * possible, so we just pretend that the upload was
  403. * successful and do the decryption in software.
  404. */
  405. /* mark the key as invalid. */
  406. key->hw_key_idx = 0xff;
  407. goto out_unlock;
  408. }
  409. } else {
  410. slot = key->hw_key_idx;
  411. if (slot == 0xff) {
  412. /* This key was not uploaded into the rx key cache. */
  413. goto out_unlock;
  414. }
  415. bitmap_release_region(priv->used_rxkeys, slot, 0);
  416. algo = 0;
  417. }
  418. if (sta)
  419. addr = sta->addr;
  420. ret = p54_upload_key(priv, algo, slot, key->keyidx,
  421. key->keylen, addr, key->key);
  422. if (ret) {
  423. bitmap_release_region(priv->used_rxkeys, slot, 0);
  424. ret = -EOPNOTSUPP;
  425. goto out_unlock;
  426. }
  427. key->hw_key_idx = slot;
  428. out_unlock:
  429. mutex_unlock(&priv->conf_mutex);
  430. return ret;
  431. }
  432. static const struct ieee80211_ops p54_ops = {
  433. .tx = p54_tx_80211,
  434. .start = p54_start,
  435. .stop = p54_stop,
  436. .add_interface = p54_add_interface,
  437. .remove_interface = p54_remove_interface,
  438. .set_tim = p54_set_tim,
  439. .sta_notify = p54_sta_notify,
  440. .set_key = p54_set_key,
  441. .config = p54_config,
  442. .bss_info_changed = p54_bss_info_changed,
  443. .configure_filter = p54_configure_filter,
  444. .conf_tx = p54_conf_tx,
  445. .get_stats = p54_get_stats,
  446. .get_tx_stats = p54_get_tx_stats
  447. };
  448. struct ieee80211_hw *p54_init_common(size_t priv_data_len)
  449. {
  450. struct ieee80211_hw *dev;
  451. struct p54_common *priv;
  452. dev = ieee80211_alloc_hw(priv_data_len, &p54_ops);
  453. if (!dev)
  454. return NULL;
  455. priv = dev->priv;
  456. priv->hw = dev;
  457. priv->mode = NL80211_IFTYPE_UNSPECIFIED;
  458. priv->basic_rate_mask = 0x15f;
  459. spin_lock_init(&priv->tx_stats_lock);
  460. skb_queue_head_init(&priv->tx_queue);
  461. skb_queue_head_init(&priv->tx_pending);
  462. dev->flags = IEEE80211_HW_RX_INCLUDES_FCS |
  463. IEEE80211_HW_SIGNAL_DBM |
  464. IEEE80211_HW_SUPPORTS_PS |
  465. IEEE80211_HW_PS_NULLFUNC_STACK |
  466. IEEE80211_HW_BEACON_FILTER |
  467. IEEE80211_HW_NOISE_DBM;
  468. dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  469. BIT(NL80211_IFTYPE_ADHOC) |
  470. BIT(NL80211_IFTYPE_AP) |
  471. BIT(NL80211_IFTYPE_MESH_POINT);
  472. dev->channel_change_time = 1000; /* TODO: find actual value */
  473. priv->beacon_req_id = cpu_to_le32(0);
  474. priv->tx_stats[P54_QUEUE_BEACON].limit = 1;
  475. priv->tx_stats[P54_QUEUE_FWSCAN].limit = 1;
  476. priv->tx_stats[P54_QUEUE_MGMT].limit = 3;
  477. priv->tx_stats[P54_QUEUE_CAB].limit = 3;
  478. priv->tx_stats[P54_QUEUE_DATA].limit = 5;
  479. dev->queues = 1;
  480. priv->noise = -94;
  481. /*
  482. * We support at most 8 tries no matter which rate they're at,
  483. * we cannot support max_rates * max_rate_tries as we set it
  484. * here, but setting it correctly to 4/2 or so would limit us
  485. * artificially if the RC algorithm wants just two rates, so
  486. * let's say 4/7, we'll redistribute it at TX time, see the
  487. * comments there.
  488. */
  489. dev->max_rates = 4;
  490. dev->max_rate_tries = 7;
  491. dev->extra_tx_headroom = sizeof(struct p54_hdr) + 4 +
  492. sizeof(struct p54_tx_data);
  493. /*
  494. * For now, disable PS by default because it affects
  495. * link stability significantly.
  496. */
  497. dev->wiphy->ps_default = false;
  498. mutex_init(&priv->conf_mutex);
  499. mutex_init(&priv->eeprom_mutex);
  500. init_completion(&priv->eeprom_comp);
  501. init_completion(&priv->beacon_comp);
  502. INIT_DELAYED_WORK(&priv->work, p54_work);
  503. return dev;
  504. }
  505. EXPORT_SYMBOL_GPL(p54_init_common);
  506. int p54_register_common(struct ieee80211_hw *dev, struct device *pdev)
  507. {
  508. struct p54_common *priv = dev->priv;
  509. int err;
  510. err = ieee80211_register_hw(dev);
  511. if (err) {
  512. dev_err(pdev, "Cannot register device (%d).\n", err);
  513. return err;
  514. }
  515. #ifdef CONFIG_P54_LEDS
  516. err = p54_init_leds(priv);
  517. if (err)
  518. return err;
  519. #endif /* CONFIG_P54_LEDS */
  520. dev_info(pdev, "is registered as '%s'\n", wiphy_name(dev->wiphy));
  521. return 0;
  522. }
  523. EXPORT_SYMBOL_GPL(p54_register_common);
  524. void p54_free_common(struct ieee80211_hw *dev)
  525. {
  526. struct p54_common *priv = dev->priv;
  527. unsigned int i;
  528. for (i = 0; i < IEEE80211_NUM_BANDS; i++)
  529. kfree(priv->band_table[i]);
  530. kfree(priv->iq_autocal);
  531. kfree(priv->output_limit);
  532. kfree(priv->curve_data);
  533. kfree(priv->used_rxkeys);
  534. priv->iq_autocal = NULL;
  535. priv->output_limit = NULL;
  536. priv->curve_data = NULL;
  537. priv->used_rxkeys = NULL;
  538. ieee80211_free_hw(dev);
  539. }
  540. EXPORT_SYMBOL_GPL(p54_free_common);
  541. void p54_unregister_common(struct ieee80211_hw *dev)
  542. {
  543. struct p54_common *priv = dev->priv;
  544. #ifdef CONFIG_P54_LEDS
  545. p54_unregister_leds(priv);
  546. #endif /* CONFIG_P54_LEDS */
  547. ieee80211_unregister_hw(dev);
  548. mutex_destroy(&priv->conf_mutex);
  549. mutex_destroy(&priv->eeprom_mutex);
  550. }
  551. EXPORT_SYMBOL_GPL(p54_unregister_common);