aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-09-30 19:06:53 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-10-05 13:35:23 -0400
commitf209f5298217cf54cd5a9163e18b08d093faf8d9 (patch)
tree28de73a4cedbcbcafcb2151c471b745feccc3f22 /drivers/net
parent2234362c427e2ef667595b9b81c0125003ac5607 (diff)
ath9k: fix channel flag / regd issues with multiple cards
Since the regulatory code touches the channel array, it needs to be copied for each device instance. That way the original channel array can also be made const. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Cc: stable@kernel.org [all] Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 11dc3ac20cd6..282bb482424f 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 */
59static struct ieee80211_channel ath9k_2ghz_chantable[] = { 59static 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 */
80static struct ieee80211_channel ath9k_5ghz_chantable[] = { 80static 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
480static void ath9k_init_channels_rates(struct ath_softc *sc) 480static 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
504static void ath9k_init_misc(struct ath_softc *sc) 520static void ath9k_init_misc(struct ath_softc *sc)
@@ -594,8 +610,11 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
594 if (ret) 610 if (ret)
595 goto err_btcoex; 611 goto err_btcoex;
596 612
613 ret = ath9k_init_channels_rates(sc);
614 if (ret)
615 goto err_btcoex;
616
597 ath9k_init_crypto(sc); 617 ath9k_init_crypto(sc);
598 ath9k_init_channels_rates(sc);
599 ath9k_init_misc(sc); 618 ath9k_init_misc(sc);
600 619
601 return 0; 620 return 0;
@@ -755,6 +774,12 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
755{ 774{
756 int i = 0; 775 int i = 0;
757 776
777 if (sc->sbands[IEEE80211_BAND_2GHZ].channels)
778 kfree(sc->sbands[IEEE80211_BAND_2GHZ].channels);
779
780 if (sc->sbands[IEEE80211_BAND_5GHZ].channels)
781 kfree(sc->sbands[IEEE80211_BAND_5GHZ].channels);
782
758 if ((sc->btcoex.no_stomp_timer) && 783 if ((sc->btcoex.no_stomp_timer) &&
759 sc->sc_ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) 784 sc->sc_ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
760 ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer); 785 ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer);