diff options
author | Rajkumar Manoharan <rmanoharan@atheros.com> | 2011-01-28 01:05:43 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-01-28 15:46:23 -0500 |
commit | de87f736e3573ccf5e8c5b45966812b7d65c0b85 (patch) | |
tree | 28920f94d3c14822be222635e85a972c66b20fa6 /drivers/net/wireless/ath/ath9k/main.c | |
parent | 6d744bacee8195c915c514409a81d470ce7b1177 (diff) |
ath9k: use common API to avoid code duplication
Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 72 |
1 files changed, 3 insertions, 69 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 0663a32d81d2..91af57c48581 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -73,7 +73,7 @@ static struct ath9k_channel *ath_get_curchannel(struct ath_softc *sc, | |||
73 | 73 | ||
74 | chan_idx = curchan->hw_value; | 74 | chan_idx = curchan->hw_value; |
75 | channel = &sc->sc_ah->channels[chan_idx]; | 75 | channel = &sc->sc_ah->channels[chan_idx]; |
76 | ath9k_update_ichannel(sc, hw, channel); | 76 | ath9k_cmn_update_ichannel(channel, curchan, hw->conf.channel_type); |
77 | return channel; | 77 | return channel; |
78 | } | 78 | } |
79 | 79 | ||
@@ -808,48 +808,6 @@ chip_reset: | |||
808 | #undef SCHED_INTR | 808 | #undef SCHED_INTR |
809 | } | 809 | } |
810 | 810 | ||
811 | static u32 ath_get_extchanmode(struct ath_softc *sc, | ||
812 | struct ieee80211_channel *chan, | ||
813 | enum nl80211_channel_type channel_type) | ||
814 | { | ||
815 | u32 chanmode = 0; | ||
816 | |||
817 | switch (chan->band) { | ||
818 | case IEEE80211_BAND_2GHZ: | ||
819 | switch(channel_type) { | ||
820 | case NL80211_CHAN_NO_HT: | ||
821 | case NL80211_CHAN_HT20: | ||
822 | chanmode = CHANNEL_G_HT20; | ||
823 | break; | ||
824 | case NL80211_CHAN_HT40PLUS: | ||
825 | chanmode = CHANNEL_G_HT40PLUS; | ||
826 | break; | ||
827 | case NL80211_CHAN_HT40MINUS: | ||
828 | chanmode = CHANNEL_G_HT40MINUS; | ||
829 | break; | ||
830 | } | ||
831 | break; | ||
832 | case IEEE80211_BAND_5GHZ: | ||
833 | switch(channel_type) { | ||
834 | case NL80211_CHAN_NO_HT: | ||
835 | case NL80211_CHAN_HT20: | ||
836 | chanmode = CHANNEL_A_HT20; | ||
837 | break; | ||
838 | case NL80211_CHAN_HT40PLUS: | ||
839 | chanmode = CHANNEL_A_HT40PLUS; | ||
840 | break; | ||
841 | case NL80211_CHAN_HT40MINUS: | ||
842 | chanmode = CHANNEL_A_HT40MINUS; | ||
843 | break; | ||
844 | } | ||
845 | break; | ||
846 | default: | ||
847 | break; | ||
848 | } | ||
849 | |||
850 | return chanmode; | ||
851 | } | ||
852 | |||
853 | static void ath9k_bss_assoc_info(struct ath_softc *sc, | 811 | static void ath9k_bss_assoc_info(struct ath_softc *sc, |
854 | struct ieee80211_hw *hw, | 812 | struct ieee80211_hw *hw, |
855 | struct ieee80211_vif *vif, | 813 | struct ieee80211_vif *vif, |
@@ -1045,30 +1003,6 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) | |||
1045 | return r; | 1003 | return r; |
1046 | } | 1004 | } |
1047 | 1005 | ||
1048 | /* XXX: Remove me once we don't depend on ath9k_channel for all | ||
1049 | * this redundant data */ | ||
1050 | void ath9k_update_ichannel(struct ath_softc *sc, struct ieee80211_hw *hw, | ||
1051 | struct ath9k_channel *ichan) | ||
1052 | { | ||
1053 | struct ieee80211_channel *chan = hw->conf.channel; | ||
1054 | struct ieee80211_conf *conf = &hw->conf; | ||
1055 | |||
1056 | ichan->channel = chan->center_freq; | ||
1057 | ichan->chan = chan; | ||
1058 | |||
1059 | if (chan->band == IEEE80211_BAND_2GHZ) { | ||
1060 | ichan->chanmode = CHANNEL_G; | ||
1061 | ichan->channelFlags = CHANNEL_2GHZ | CHANNEL_OFDM | CHANNEL_G; | ||
1062 | } else { | ||
1063 | ichan->chanmode = CHANNEL_A; | ||
1064 | ichan->channelFlags = CHANNEL_5GHZ | CHANNEL_OFDM; | ||
1065 | } | ||
1066 | |||
1067 | if (conf_is_ht(conf)) | ||
1068 | ichan->chanmode = ath_get_extchanmode(sc, chan, | ||
1069 | conf->channel_type); | ||
1070 | } | ||
1071 | |||
1072 | /**********************/ | 1006 | /**********************/ |
1073 | /* mac80211 callbacks */ | 1007 | /* mac80211 callbacks */ |
1074 | /**********************/ | 1008 | /**********************/ |
@@ -1727,8 +1661,8 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1727 | ath_dbg(common, ATH_DBG_CONFIG, "Set channel: %d MHz\n", | 1661 | ath_dbg(common, ATH_DBG_CONFIG, "Set channel: %d MHz\n", |
1728 | curchan->center_freq); | 1662 | curchan->center_freq); |
1729 | 1663 | ||
1730 | /* XXX: remove me eventualy */ | 1664 | ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos], |
1731 | ath9k_update_ichannel(sc, hw, &sc->sc_ah->channels[pos]); | 1665 | curchan, conf->channel_type); |
1732 | 1666 | ||
1733 | /* update survey stats for the old channel before switching */ | 1667 | /* update survey stats for the old channel before switching */ |
1734 | spin_lock_irqsave(&common->cc_lock, flags); | 1668 | spin_lock_irqsave(&common->cc_lock, flags); |