sfc: Don't use enums as a bitmask.
[zen-stable.git] / drivers / net / wireless / p54 / main.c
bloba5a6d9e647bbe31fcf6909e504b570543c584115
1 /*
2 * mac80211 glue code for mac80211 Prism54 drivers
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>
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).
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.
19 #include <linux/init.h>
20 #include <linux/slab.h>
21 #include <linux/firmware.h>
22 #include <linux/etherdevice.h>
24 #include <net/mac80211.h>
26 #include "p54.h"
27 #include "lmac.h"
29 static int modparam_nohwcrypt;
30 module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
31 MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
32 MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>");
33 MODULE_DESCRIPTION("Softmac Prism54 common code");
34 MODULE_LICENSE("GPL");
35 MODULE_ALIAS("prism54common");
37 static int p54_sta_add_remove(struct ieee80211_hw *hw,
38 struct ieee80211_vif *vif,
39 struct ieee80211_sta *sta)
41 struct p54_common *priv = hw->priv;
44 * Notify the firmware that we don't want or we don't
45 * need to buffer frames for this station anymore.
48 p54_sta_unlock(priv, sta->addr);
50 return 0;
53 static void p54_sta_notify(struct ieee80211_hw *dev, struct ieee80211_vif *vif,
54 enum sta_notify_cmd notify_cmd,
55 struct ieee80211_sta *sta)
57 struct p54_common *priv = dev->priv;
59 switch (notify_cmd) {
60 case STA_NOTIFY_AWAKE:
61 /* update the firmware's filter table */
62 p54_sta_unlock(priv, sta->addr);
63 break;
64 default:
65 break;
69 static int p54_set_tim(struct ieee80211_hw *dev, struct ieee80211_sta *sta,
70 bool set)
72 struct p54_common *priv = dev->priv;
74 return p54_update_beacon_tim(priv, sta->aid, set);
77 u8 *p54_find_ie(struct sk_buff *skb, u8 ie)
79 struct ieee80211_mgmt *mgmt = (void *)skb->data;
80 u8 *pos, *end;
82 if (skb->len <= sizeof(mgmt))
83 return NULL;
85 pos = (u8 *)mgmt->u.beacon.variable;
86 end = skb->data + skb->len;
87 while (pos < end) {
88 if (pos + 2 + pos[1] > end)
89 return NULL;
91 if (pos[0] == ie)
92 return pos;
94 pos += 2 + pos[1];
96 return NULL;
99 static int p54_beacon_format_ie_tim(struct sk_buff *skb)
102 * the good excuse for this mess is ... the firmware.
103 * The dummy TIM MUST be at the end of the beacon frame,
104 * because it'll be overwritten!
106 u8 *tim;
107 u8 dtim_len;
108 u8 dtim_period;
109 u8 *next;
111 tim = p54_find_ie(skb, WLAN_EID_TIM);
112 if (!tim)
113 return 0;
115 dtim_len = tim[1];
116 dtim_period = tim[3];
117 next = tim + 2 + dtim_len;
119 if (dtim_len < 3)
120 return -EINVAL;
122 memmove(tim, next, skb_tail_pointer(skb) - next);
123 tim = skb_tail_pointer(skb) - (dtim_len + 2);
125 /* add the dummy at the end */
126 tim[0] = WLAN_EID_TIM;
127 tim[1] = 3;
128 tim[2] = 0;
129 tim[3] = dtim_period;
130 tim[4] = 0;
132 if (dtim_len > 3)
133 skb_trim(skb, skb->len - (dtim_len - 3));
135 return 0;
138 static int p54_beacon_update(struct p54_common *priv,
139 struct ieee80211_vif *vif)
141 struct sk_buff *beacon;
142 int ret;
144 beacon = ieee80211_beacon_get(priv->hw, vif);
145 if (!beacon)
146 return -ENOMEM;
147 ret = p54_beacon_format_ie_tim(beacon);
148 if (ret)
149 return ret;
152 * During operation, the firmware takes care of beaconing.
153 * The driver only needs to upload a new beacon template, once
154 * the template was changed by the stack or userspace.
156 * LMAC API 3.2.2 also specifies that the driver does not need
157 * to cancel the old beacon template by hand, instead the firmware
158 * will release the previous one through the feedback mechanism.
160 p54_tx_80211(priv->hw, beacon);
161 priv->tsf_high32 = 0;
162 priv->tsf_low32 = 0;
164 return 0;
167 static int p54_start(struct ieee80211_hw *dev)
169 struct p54_common *priv = dev->priv;
170 int err;
172 mutex_lock(&priv->conf_mutex);
173 err = priv->open(dev);
174 if (err)
175 goto out;
176 P54_SET_QUEUE(priv->qos_params[0], 0x0002, 0x0003, 0x0007, 47);
177 P54_SET_QUEUE(priv->qos_params[1], 0x0002, 0x0007, 0x000f, 94);
178 P54_SET_QUEUE(priv->qos_params[2], 0x0003, 0x000f, 0x03ff, 0);
179 P54_SET_QUEUE(priv->qos_params[3], 0x0007, 0x000f, 0x03ff, 0);
180 err = p54_set_edcf(priv);
181 if (err)
182 goto out;
184 memset(priv->bssid, ~0, ETH_ALEN);
185 priv->mode = NL80211_IFTYPE_MONITOR;
186 err = p54_setup_mac(priv);
187 if (err) {
188 priv->mode = NL80211_IFTYPE_UNSPECIFIED;
189 goto out;
192 ieee80211_queue_delayed_work(dev, &priv->work, 0);
194 priv->softled_state = 0;
195 err = p54_set_leds(priv);
197 out:
198 mutex_unlock(&priv->conf_mutex);
199 return err;
202 static void p54_stop(struct ieee80211_hw *dev)
204 struct p54_common *priv = dev->priv;
205 int i;
207 mutex_lock(&priv->conf_mutex);
208 priv->mode = NL80211_IFTYPE_UNSPECIFIED;
209 priv->softled_state = 0;
210 p54_set_leds(priv);
212 cancel_delayed_work_sync(&priv->work);
214 priv->stop(dev);
215 skb_queue_purge(&priv->tx_pending);
216 skb_queue_purge(&priv->tx_queue);
217 for (i = 0; i < P54_QUEUE_NUM; i++) {
218 priv->tx_stats[i].count = 0;
219 priv->tx_stats[i].len = 0;
222 priv->beacon_req_id = cpu_to_le32(0);
223 priv->tsf_high32 = priv->tsf_low32 = 0;
224 mutex_unlock(&priv->conf_mutex);
227 static int p54_add_interface(struct ieee80211_hw *dev,
228 struct ieee80211_vif *vif)
230 struct p54_common *priv = dev->priv;
232 mutex_lock(&priv->conf_mutex);
233 if (priv->mode != NL80211_IFTYPE_MONITOR) {
234 mutex_unlock(&priv->conf_mutex);
235 return -EOPNOTSUPP;
238 priv->vif = vif;
240 switch (vif->type) {
241 case NL80211_IFTYPE_STATION:
242 case NL80211_IFTYPE_ADHOC:
243 case NL80211_IFTYPE_AP:
244 case NL80211_IFTYPE_MESH_POINT:
245 priv->mode = vif->type;
246 break;
247 default:
248 mutex_unlock(&priv->conf_mutex);
249 return -EOPNOTSUPP;
252 memcpy(priv->mac_addr, vif->addr, ETH_ALEN);
253 p54_setup_mac(priv);
254 mutex_unlock(&priv->conf_mutex);
255 return 0;
258 static void p54_remove_interface(struct ieee80211_hw *dev,
259 struct ieee80211_vif *vif)
261 struct p54_common *priv = dev->priv;
263 mutex_lock(&priv->conf_mutex);
264 priv->vif = NULL;
267 * LMAC API 3.2.2 states that any active beacon template must be
268 * canceled by the driver before attempting a mode transition.
270 if (le32_to_cpu(priv->beacon_req_id) != 0) {
271 p54_tx_cancel(priv, priv->beacon_req_id);
272 wait_for_completion_interruptible_timeout(&priv->beacon_comp, HZ);
274 priv->mode = NL80211_IFTYPE_MONITOR;
275 memset(priv->mac_addr, 0, ETH_ALEN);
276 memset(priv->bssid, 0, ETH_ALEN);
277 p54_setup_mac(priv);
278 mutex_unlock(&priv->conf_mutex);
281 static int p54_config(struct ieee80211_hw *dev, u32 changed)
283 int ret = 0;
284 struct p54_common *priv = dev->priv;
285 struct ieee80211_conf *conf = &dev->conf;
287 mutex_lock(&priv->conf_mutex);
288 if (changed & IEEE80211_CONF_CHANGE_POWER)
289 priv->output_power = conf->power_level << 2;
290 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
291 ret = p54_scan(priv, P54_SCAN_EXIT, 0);
292 if (ret)
293 goto out;
295 if (changed & IEEE80211_CONF_CHANGE_PS) {
296 ret = p54_set_ps(priv);
297 if (ret)
298 goto out;
300 if (changed & IEEE80211_CONF_CHANGE_IDLE) {
301 ret = p54_setup_mac(priv);
302 if (ret)
303 goto out;
306 out:
307 mutex_unlock(&priv->conf_mutex);
308 return ret;
311 static u64 p54_prepare_multicast(struct ieee80211_hw *dev,
312 struct netdev_hw_addr_list *mc_list)
314 struct p54_common *priv = dev->priv;
315 struct netdev_hw_addr *ha;
316 int i;
318 BUILD_BUG_ON(ARRAY_SIZE(priv->mc_maclist) !=
319 ARRAY_SIZE(((struct p54_group_address_table *)NULL)->mac_list));
321 * The first entry is reserved for the global broadcast MAC.
322 * Otherwise the firmware will drop it and ARP will no longer work.
324 i = 1;
325 priv->mc_maclist_num = netdev_hw_addr_list_count(mc_list) + i;
326 netdev_hw_addr_list_for_each(ha, mc_list) {
327 memcpy(&priv->mc_maclist[i], ha->addr, ETH_ALEN);
328 i++;
329 if (i >= ARRAY_SIZE(priv->mc_maclist))
330 break;
333 return 1; /* update */
336 static void p54_configure_filter(struct ieee80211_hw *dev,
337 unsigned int changed_flags,
338 unsigned int *total_flags,
339 u64 multicast)
341 struct p54_common *priv = dev->priv;
343 *total_flags &= FIF_PROMISC_IN_BSS |
344 FIF_ALLMULTI |
345 FIF_OTHER_BSS;
347 priv->filter_flags = *total_flags;
349 if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS))
350 p54_setup_mac(priv);
352 if (changed_flags & FIF_ALLMULTI || multicast)
353 p54_set_groupfilter(priv);
356 static int p54_conf_tx(struct ieee80211_hw *dev, u16 queue,
357 const struct ieee80211_tx_queue_params *params)
359 struct p54_common *priv = dev->priv;
360 int ret;
362 mutex_lock(&priv->conf_mutex);
363 if (queue < dev->queues) {
364 P54_SET_QUEUE(priv->qos_params[queue], params->aifs,
365 params->cw_min, params->cw_max, params->txop);
366 ret = p54_set_edcf(priv);
367 } else
368 ret = -EINVAL;
369 mutex_unlock(&priv->conf_mutex);
370 return ret;
373 static void p54_work(struct work_struct *work)
375 struct p54_common *priv = container_of(work, struct p54_common,
376 work.work);
378 if (unlikely(priv->mode == NL80211_IFTYPE_UNSPECIFIED))
379 return ;
382 * TODO: walk through tx_queue and do the following tasks
383 * 1. initiate bursts.
384 * 2. cancel stuck frames / reset the device if necessary.
387 p54_fetch_statistics(priv);
390 static int p54_get_stats(struct ieee80211_hw *dev,
391 struct ieee80211_low_level_stats *stats)
393 struct p54_common *priv = dev->priv;
395 memcpy(stats, &priv->stats, sizeof(*stats));
396 return 0;
399 static void p54_bss_info_changed(struct ieee80211_hw *dev,
400 struct ieee80211_vif *vif,
401 struct ieee80211_bss_conf *info,
402 u32 changed)
404 struct p54_common *priv = dev->priv;
406 mutex_lock(&priv->conf_mutex);
407 if (changed & BSS_CHANGED_BSSID) {
408 memcpy(priv->bssid, info->bssid, ETH_ALEN);
409 p54_setup_mac(priv);
412 if (changed & BSS_CHANGED_BEACON) {
413 p54_scan(priv, P54_SCAN_EXIT, 0);
414 p54_setup_mac(priv);
415 p54_beacon_update(priv, vif);
416 p54_set_edcf(priv);
419 if (changed & (BSS_CHANGED_ERP_SLOT | BSS_CHANGED_BEACON)) {
420 priv->use_short_slot = info->use_short_slot;
421 p54_set_edcf(priv);
423 if (changed & BSS_CHANGED_BASIC_RATES) {
424 if (dev->conf.channel->band == IEEE80211_BAND_5GHZ)
425 priv->basic_rate_mask = (info->basic_rates << 4);
426 else
427 priv->basic_rate_mask = info->basic_rates;
428 p54_setup_mac(priv);
429 if (priv->fw_var >= 0x500)
430 p54_scan(priv, P54_SCAN_EXIT, 0);
432 if (changed & BSS_CHANGED_ASSOC) {
433 if (info->assoc) {
434 priv->aid = info->aid;
435 priv->wakeup_timer = info->beacon_int *
436 info->dtim_period * 5;
437 p54_setup_mac(priv);
438 } else {
439 priv->wakeup_timer = 500;
440 priv->aid = 0;
444 mutex_unlock(&priv->conf_mutex);
447 static int p54_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,
448 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
449 struct ieee80211_key_conf *key)
451 struct p54_common *priv = dev->priv;
452 int slot, ret = 0;
453 u8 algo = 0;
454 u8 *addr = NULL;
456 if (modparam_nohwcrypt)
457 return -EOPNOTSUPP;
459 mutex_lock(&priv->conf_mutex);
460 if (cmd == SET_KEY) {
461 switch (key->cipher) {
462 case WLAN_CIPHER_SUITE_TKIP:
463 if (!(priv->privacy_caps & (BR_DESC_PRIV_CAP_MICHAEL |
464 BR_DESC_PRIV_CAP_TKIP))) {
465 ret = -EOPNOTSUPP;
466 goto out_unlock;
468 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
469 algo = P54_CRYPTO_TKIPMICHAEL;
470 break;
471 case WLAN_CIPHER_SUITE_WEP40:
472 case WLAN_CIPHER_SUITE_WEP104:
473 if (!(priv->privacy_caps & BR_DESC_PRIV_CAP_WEP)) {
474 ret = -EOPNOTSUPP;
475 goto out_unlock;
477 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
478 algo = P54_CRYPTO_WEP;
479 break;
480 case WLAN_CIPHER_SUITE_CCMP:
481 if (!(priv->privacy_caps & BR_DESC_PRIV_CAP_AESCCMP)) {
482 ret = -EOPNOTSUPP;
483 goto out_unlock;
485 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
486 algo = P54_CRYPTO_AESCCMP;
487 break;
488 default:
489 ret = -EOPNOTSUPP;
490 goto out_unlock;
492 slot = bitmap_find_free_region(priv->used_rxkeys,
493 priv->rx_keycache_size, 0);
495 if (slot < 0) {
497 * The device supports the chosen algorithm, but the
498 * firmware does not provide enough key slots to store
499 * all of them.
500 * But encryption offload for outgoing frames is always
501 * possible, so we just pretend that the upload was
502 * successful and do the decryption in software.
505 /* mark the key as invalid. */
506 key->hw_key_idx = 0xff;
507 goto out_unlock;
509 } else {
510 slot = key->hw_key_idx;
512 if (slot == 0xff) {
513 /* This key was not uploaded into the rx key cache. */
515 goto out_unlock;
518 bitmap_release_region(priv->used_rxkeys, slot, 0);
519 algo = 0;
522 if (sta)
523 addr = sta->addr;
525 ret = p54_upload_key(priv, algo, slot, key->keyidx,
526 key->keylen, addr, key->key);
527 if (ret) {
528 bitmap_release_region(priv->used_rxkeys, slot, 0);
529 ret = -EOPNOTSUPP;
530 goto out_unlock;
533 key->hw_key_idx = slot;
535 out_unlock:
536 mutex_unlock(&priv->conf_mutex);
537 return ret;
540 static int p54_get_survey(struct ieee80211_hw *dev, int idx,
541 struct survey_info *survey)
543 struct p54_common *priv = dev->priv;
544 struct ieee80211_conf *conf = &dev->conf;
546 if (idx != 0)
547 return -ENOENT;
549 survey->channel = conf->channel;
550 survey->filled = SURVEY_INFO_NOISE_DBM;
551 survey->noise = clamp_t(s8, priv->noise, -128, 127);
553 return 0;
556 static unsigned int p54_flush_count(struct p54_common *priv)
558 unsigned int total = 0, i;
560 BUILD_BUG_ON(P54_QUEUE_NUM > ARRAY_SIZE(priv->tx_stats));
563 * Because the firmware has the sole control over any frames
564 * in the P54_QUEUE_BEACON or P54_QUEUE_SCAN queues, they
565 * don't really count as pending or active.
567 for (i = P54_QUEUE_MGMT; i < P54_QUEUE_NUM; i++)
568 total += priv->tx_stats[i].len;
569 return total;
572 static void p54_flush(struct ieee80211_hw *dev, bool drop)
574 struct p54_common *priv = dev->priv;
575 unsigned int total, i;
578 * Currently, it wouldn't really matter if we wait for one second
579 * or 15 minutes. But once someone gets around and completes the
580 * TODOs [ancel stuck frames / reset device] in p54_work, it will
581 * suddenly make sense to wait that long.
583 i = P54_STATISTICS_UPDATE * 2 / 20;
586 * In this case no locking is required because as we speak the
587 * queues have already been stopped and no new frames can sneak
588 * up from behind.
590 while ((total = p54_flush_count(priv) && i--)) {
591 /* waste time */
592 msleep(20);
595 WARN(total, "tx flush timeout, unresponsive firmware");
598 static void p54_set_coverage_class(struct ieee80211_hw *dev, u8 coverage_class)
600 struct p54_common *priv = dev->priv;
602 mutex_lock(&priv->conf_mutex);
603 /* support all coverage class values as in 802.11-2007 Table 7-27 */
604 priv->coverage_class = clamp_t(u8, coverage_class, 0, 31);
605 p54_set_edcf(priv);
606 mutex_unlock(&priv->conf_mutex);
609 static const struct ieee80211_ops p54_ops = {
610 .tx = p54_tx_80211,
611 .start = p54_start,
612 .stop = p54_stop,
613 .add_interface = p54_add_interface,
614 .remove_interface = p54_remove_interface,
615 .set_tim = p54_set_tim,
616 .sta_notify = p54_sta_notify,
617 .sta_add = p54_sta_add_remove,
618 .sta_remove = p54_sta_add_remove,
619 .set_key = p54_set_key,
620 .config = p54_config,
621 .flush = p54_flush,
622 .bss_info_changed = p54_bss_info_changed,
623 .prepare_multicast = p54_prepare_multicast,
624 .configure_filter = p54_configure_filter,
625 .conf_tx = p54_conf_tx,
626 .get_stats = p54_get_stats,
627 .get_survey = p54_get_survey,
628 .set_coverage_class = p54_set_coverage_class,
631 struct ieee80211_hw *p54_init_common(size_t priv_data_len)
633 struct ieee80211_hw *dev;
634 struct p54_common *priv;
636 dev = ieee80211_alloc_hw(priv_data_len, &p54_ops);
637 if (!dev)
638 return NULL;
640 priv = dev->priv;
641 priv->hw = dev;
642 priv->mode = NL80211_IFTYPE_UNSPECIFIED;
643 priv->basic_rate_mask = 0x15f;
644 spin_lock_init(&priv->tx_stats_lock);
645 skb_queue_head_init(&priv->tx_queue);
646 skb_queue_head_init(&priv->tx_pending);
647 dev->flags = IEEE80211_HW_RX_INCLUDES_FCS |
648 IEEE80211_HW_SIGNAL_DBM |
649 IEEE80211_HW_SUPPORTS_PS |
650 IEEE80211_HW_PS_NULLFUNC_STACK |
651 IEEE80211_HW_BEACON_FILTER |
652 IEEE80211_HW_REPORTS_TX_ACK_STATUS;
654 dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
655 BIT(NL80211_IFTYPE_ADHOC) |
656 BIT(NL80211_IFTYPE_AP) |
657 BIT(NL80211_IFTYPE_MESH_POINT);
659 dev->channel_change_time = 1000; /* TODO: find actual value */
660 priv->beacon_req_id = cpu_to_le32(0);
661 priv->tx_stats[P54_QUEUE_BEACON].limit = 1;
662 priv->tx_stats[P54_QUEUE_FWSCAN].limit = 1;
663 priv->tx_stats[P54_QUEUE_MGMT].limit = 3;
664 priv->tx_stats[P54_QUEUE_CAB].limit = 3;
665 priv->tx_stats[P54_QUEUE_DATA].limit = 5;
666 dev->queues = 1;
667 priv->noise = -94;
669 * We support at most 8 tries no matter which rate they're at,
670 * we cannot support max_rates * max_rate_tries as we set it
671 * here, but setting it correctly to 4/2 or so would limit us
672 * artificially if the RC algorithm wants just two rates, so
673 * let's say 4/7, we'll redistribute it at TX time, see the
674 * comments there.
676 dev->max_rates = 4;
677 dev->max_rate_tries = 7;
678 dev->extra_tx_headroom = sizeof(struct p54_hdr) + 4 +
679 sizeof(struct p54_tx_data);
682 * For now, disable PS by default because it affects
683 * link stability significantly.
685 dev->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
687 mutex_init(&priv->conf_mutex);
688 mutex_init(&priv->eeprom_mutex);
689 init_completion(&priv->eeprom_comp);
690 init_completion(&priv->beacon_comp);
691 INIT_DELAYED_WORK(&priv->work, p54_work);
693 memset(&priv->mc_maclist[0], ~0, ETH_ALEN);
694 return dev;
696 EXPORT_SYMBOL_GPL(p54_init_common);
698 int p54_register_common(struct ieee80211_hw *dev, struct device *pdev)
700 struct p54_common __maybe_unused *priv = dev->priv;
701 int err;
703 err = ieee80211_register_hw(dev);
704 if (err) {
705 dev_err(pdev, "Cannot register device (%d).\n", err);
706 return err;
709 #ifdef CONFIG_P54_LEDS
710 err = p54_init_leds(priv);
711 if (err)
712 return err;
713 #endif /* CONFIG_P54_LEDS */
715 dev_info(pdev, "is registered as '%s'\n", wiphy_name(dev->wiphy));
716 return 0;
718 EXPORT_SYMBOL_GPL(p54_register_common);
720 void p54_free_common(struct ieee80211_hw *dev)
722 struct p54_common *priv = dev->priv;
723 unsigned int i;
725 for (i = 0; i < IEEE80211_NUM_BANDS; i++)
726 kfree(priv->band_table[i]);
728 kfree(priv->iq_autocal);
729 kfree(priv->output_limit);
730 kfree(priv->curve_data);
731 kfree(priv->rssi_db);
732 kfree(priv->used_rxkeys);
733 priv->iq_autocal = NULL;
734 priv->output_limit = NULL;
735 priv->curve_data = NULL;
736 priv->rssi_db = NULL;
737 priv->used_rxkeys = NULL;
738 ieee80211_free_hw(dev);
740 EXPORT_SYMBOL_GPL(p54_free_common);
742 void p54_unregister_common(struct ieee80211_hw *dev)
744 struct p54_common *priv = dev->priv;
746 #ifdef CONFIG_P54_LEDS
747 p54_unregister_leds(priv);
748 #endif /* CONFIG_P54_LEDS */
750 ieee80211_unregister_hw(dev);
751 mutex_destroy(&priv->conf_mutex);
752 mutex_destroy(&priv->eeprom_mutex);
754 EXPORT_SYMBOL_GPL(p54_unregister_common);