diff options
author | Jeremy Erickson <jerickso@cs.unc.edu> | 2014-04-18 17:06:00 -0400 |
---|---|---|
committer | Jeremy Erickson <jerickso@cs.unc.edu> | 2014-04-18 17:06:00 -0400 |
commit | a215aa7b9ab3759c047201199fba64d3042d7f13 (patch) | |
tree | bca37493d9b2233450e6d3ffced1261d0e4f71fe /drivers/net/wireless/ath/ath9k/init.c | |
parent | d31199a77ef606f1d06894385f1852181ba6136b (diff) |
Update 2.6.36 to 2.6.36.4wip-dissipation2-jerickso
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/init.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/init.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 243c1775f343..2e4724f1c662 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -56,7 +56,7 @@ MODULE_PARM_DESC(blink, "Enable LED blink on activity"); | |||
56 | * on 5 MHz steps, we support the channels which we know | 56 | * on 5 MHz steps, we support the channels which we know |
57 | * we have calibration data for all cards though to make | 57 | * we have calibration data for all cards though to make |
58 | * this static */ | 58 | * this static */ |
59 | static struct ieee80211_channel ath9k_2ghz_chantable[] = { | 59 | static const struct ieee80211_channel ath9k_2ghz_chantable[] = { |
60 | CHAN2G(2412, 0), /* Channel 1 */ | 60 | CHAN2G(2412, 0), /* Channel 1 */ |
61 | CHAN2G(2417, 1), /* Channel 2 */ | 61 | CHAN2G(2417, 1), /* Channel 2 */ |
62 | CHAN2G(2422, 2), /* Channel 3 */ | 62 | CHAN2G(2422, 2), /* Channel 3 */ |
@@ -77,7 +77,7 @@ static struct ieee80211_channel ath9k_2ghz_chantable[] = { | |||
77 | * on 5 MHz steps, we support the channels which we know | 77 | * on 5 MHz steps, we support the channels which we know |
78 | * we have calibration data for all cards though to make | 78 | * we have calibration data for all cards though to make |
79 | * this static */ | 79 | * this static */ |
80 | static struct ieee80211_channel ath9k_5ghz_chantable[] = { | 80 | static const struct ieee80211_channel ath9k_5ghz_chantable[] = { |
81 | /* _We_ call this UNII 1 */ | 81 | /* _We_ call this UNII 1 */ |
82 | CHAN5G(5180, 14), /* Channel 36 */ | 82 | CHAN5G(5180, 14), /* Channel 36 */ |
83 | CHAN5G(5200, 15), /* Channel 40 */ | 83 | CHAN5G(5200, 15), /* Channel 40 */ |
@@ -477,10 +477,17 @@ err: | |||
477 | return -EIO; | 477 | return -EIO; |
478 | } | 478 | } |
479 | 479 | ||
480 | static void ath9k_init_channels_rates(struct ath_softc *sc) | 480 | static int ath9k_init_channels_rates(struct ath_softc *sc) |
481 | { | 481 | { |
482 | void *channels; | ||
483 | |||
482 | if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) { | 484 | if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) { |
483 | sc->sbands[IEEE80211_BAND_2GHZ].channels = ath9k_2ghz_chantable; | 485 | channels = kmemdup(ath9k_2ghz_chantable, |
486 | sizeof(ath9k_2ghz_chantable), GFP_KERNEL); | ||
487 | if (!channels) | ||
488 | return -ENOMEM; | ||
489 | |||
490 | sc->sbands[IEEE80211_BAND_2GHZ].channels = channels; | ||
484 | sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; | 491 | sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; |
485 | sc->sbands[IEEE80211_BAND_2GHZ].n_channels = | 492 | sc->sbands[IEEE80211_BAND_2GHZ].n_channels = |
486 | ARRAY_SIZE(ath9k_2ghz_chantable); | 493 | ARRAY_SIZE(ath9k_2ghz_chantable); |
@@ -490,7 +497,15 @@ static void ath9k_init_channels_rates(struct ath_softc *sc) | |||
490 | } | 497 | } |
491 | 498 | ||
492 | if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) { | 499 | if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) { |
493 | sc->sbands[IEEE80211_BAND_5GHZ].channels = ath9k_5ghz_chantable; | 500 | channels = kmemdup(ath9k_5ghz_chantable, |
501 | sizeof(ath9k_5ghz_chantable), GFP_KERNEL); | ||
502 | if (!channels) { | ||
503 | if (sc->sbands[IEEE80211_BAND_2GHZ].channels) | ||
504 | kfree(sc->sbands[IEEE80211_BAND_2GHZ].channels); | ||
505 | return -ENOMEM; | ||
506 | } | ||
507 | |||
508 | sc->sbands[IEEE80211_BAND_5GHZ].channels = channels; | ||
494 | sc->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ; | 509 | sc->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ; |
495 | sc->sbands[IEEE80211_BAND_5GHZ].n_channels = | 510 | sc->sbands[IEEE80211_BAND_5GHZ].n_channels = |
496 | ARRAY_SIZE(ath9k_5ghz_chantable); | 511 | ARRAY_SIZE(ath9k_5ghz_chantable); |
@@ -499,6 +514,7 @@ static void ath9k_init_channels_rates(struct ath_softc *sc) | |||
499 | sc->sbands[IEEE80211_BAND_5GHZ].n_bitrates = | 514 | sc->sbands[IEEE80211_BAND_5GHZ].n_bitrates = |
500 | ARRAY_SIZE(ath9k_legacy_rates) - 4; | 515 | ARRAY_SIZE(ath9k_legacy_rates) - 4; |
501 | } | 516 | } |
517 | return 0; | ||
502 | } | 518 | } |
503 | 519 | ||
504 | static void ath9k_init_misc(struct ath_softc *sc) | 520 | static void ath9k_init_misc(struct ath_softc *sc) |
@@ -558,7 +574,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
558 | common->debug_mask = ath9k_debug; | 574 | common->debug_mask = ath9k_debug; |
559 | 575 | ||
560 | spin_lock_init(&sc->wiphy_lock); | 576 | spin_lock_init(&sc->wiphy_lock); |
561 | spin_lock_init(&sc->sc_resetlock); | ||
562 | spin_lock_init(&sc->sc_serial_rw); | 577 | spin_lock_init(&sc->sc_serial_rw); |
563 | spin_lock_init(&sc->sc_pm_lock); | 578 | spin_lock_init(&sc->sc_pm_lock); |
564 | mutex_init(&sc->mutex); | 579 | mutex_init(&sc->mutex); |
@@ -593,8 +608,11 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
593 | if (ret) | 608 | if (ret) |
594 | goto err_btcoex; | 609 | goto err_btcoex; |
595 | 610 | ||
611 | ret = ath9k_init_channels_rates(sc); | ||
612 | if (ret) | ||
613 | goto err_btcoex; | ||
614 | |||
596 | ath9k_init_crypto(sc); | 615 | ath9k_init_crypto(sc); |
597 | ath9k_init_channels_rates(sc); | ||
598 | ath9k_init_misc(sc); | 616 | ath9k_init_misc(sc); |
599 | 617 | ||
600 | return 0; | 618 | return 0; |
@@ -641,7 +659,8 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
641 | BIT(NL80211_IFTYPE_ADHOC) | | 659 | BIT(NL80211_IFTYPE_ADHOC) | |
642 | BIT(NL80211_IFTYPE_MESH_POINT); | 660 | BIT(NL80211_IFTYPE_MESH_POINT); |
643 | 661 | ||
644 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 662 | if (AR_SREV_5416(sc->sc_ah)) |
663 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | ||
645 | 664 | ||
646 | hw->queues = 4; | 665 | hw->queues = 4; |
647 | hw->max_rates = 4; | 666 | hw->max_rates = 4; |
@@ -751,6 +770,12 @@ static void ath9k_deinit_softc(struct ath_softc *sc) | |||
751 | { | 770 | { |
752 | int i = 0; | 771 | int i = 0; |
753 | 772 | ||
773 | if (sc->sbands[IEEE80211_BAND_2GHZ].channels) | ||
774 | kfree(sc->sbands[IEEE80211_BAND_2GHZ].channels); | ||
775 | |||
776 | if (sc->sbands[IEEE80211_BAND_5GHZ].channels) | ||
777 | kfree(sc->sbands[IEEE80211_BAND_5GHZ].channels); | ||
778 | |||
754 | if ((sc->btcoex.no_stomp_timer) && | 779 | if ((sc->btcoex.no_stomp_timer) && |
755 | sc->sc_ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) | 780 | sc->sc_ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) |
756 | ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer); | 781 | ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer); |