Commit 2297f1c7 authored by Felix Fietkau's avatar Felix Fietkau Committed by John W. Linville

ath9k: make ath9k_cmn_update_ichannel static

Rework its wrapper function to make it more generic, using it as a
replacement for previous calls to ath9k_cmn_update_ichannel.
Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6b21fd20
...@@ -52,7 +52,7 @@ EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_keytype); ...@@ -52,7 +52,7 @@ EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_keytype);
/* /*
* Update internal channel flags. * Update internal channel flags.
*/ */
void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, static void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
struct cfg80211_chan_def *chandef) struct cfg80211_chan_def *chandef)
{ {
struct ieee80211_channel *chan = chandef->chan; struct ieee80211_channel *chan = chandef->chan;
...@@ -88,25 +88,25 @@ void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, ...@@ -88,25 +88,25 @@ void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
ichan->channelFlags = flags; ichan->channelFlags = flags;
} }
EXPORT_SYMBOL(ath9k_cmn_update_ichannel);
/* /*
* Get the internal channel reference. * Get the internal channel reference.
*/ */
struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw, struct ath9k_channel *ath9k_cmn_get_channel(struct ieee80211_hw *hw,
struct ath_hw *ah) struct ath_hw *ah,
struct cfg80211_chan_def *chandef)
{ {
struct ieee80211_channel *curchan = hw->conf.chandef.chan; struct ieee80211_channel *curchan = chandef->chan;
struct ath9k_channel *channel; struct ath9k_channel *channel;
u8 chan_idx; u8 chan_idx;
chan_idx = curchan->hw_value; chan_idx = curchan->hw_value;
channel = &ah->channels[chan_idx]; channel = &ah->channels[chan_idx];
ath9k_cmn_update_ichannel(channel, &hw->conf.chandef); ath9k_cmn_update_ichannel(channel, chandef);
return channel; return channel;
} }
EXPORT_SYMBOL(ath9k_cmn_get_curchannel); EXPORT_SYMBOL(ath9k_cmn_get_channel);
int ath9k_cmn_count_streams(unsigned int chainmask, int max) int ath9k_cmn_count_streams(unsigned int chainmask, int max)
{ {
......
...@@ -43,10 +43,9 @@ ...@@ -43,10 +43,9 @@
(((x) + ((mul)/2)) / (mul)) (((x) + ((mul)/2)) / (mul))
int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb); int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb);
void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, struct ath9k_channel *ath9k_cmn_get_channel(struct ieee80211_hw *hw,
struct ath_hw *ah,
struct cfg80211_chan_def *chandef); struct cfg80211_chan_def *chandef);
struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw,
struct ath_hw *ah);
int ath9k_cmn_count_streams(unsigned int chainmask, int max); int ath9k_cmn_count_streams(unsigned int chainmask, int max);
void ath9k_cmn_btcoex_bt_stomp(struct ath_common *common, void ath9k_cmn_btcoex_bt_stomp(struct ath_common *common,
enum ath_stomp_type stomp_type); enum ath_stomp_type stomp_type);
......
...@@ -906,7 +906,7 @@ static int ath9k_htc_start(struct ieee80211_hw *hw) ...@@ -906,7 +906,7 @@ static int ath9k_htc_start(struct ieee80211_hw *hw)
WMI_CMD(WMI_FLUSH_RECV_CMDID); WMI_CMD(WMI_FLUSH_RECV_CMDID);
/* setup initial channel */ /* setup initial channel */
init_channel = ath9k_cmn_get_curchannel(hw, ah); init_channel = ath9k_cmn_get_channel(hw, ah, &hw->conf.chandef);
ret = ath9k_hw_reset(ah, init_channel, ah->caldata, false); ret = ath9k_hw_reset(ah, init_channel, ah->caldata, false);
if (ret) { if (ret) {
...@@ -1188,9 +1188,7 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed) ...@@ -1188,9 +1188,7 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed)
ath_dbg(common, CONFIG, "Set channel: %d MHz\n", ath_dbg(common, CONFIG, "Set channel: %d MHz\n",
curchan->center_freq); curchan->center_freq);
ath9k_cmn_update_ichannel(&priv->ah->channels[pos], ath9k_cmn_get_channel(hw, priv->ah, &hw->conf.chandef);
&hw->conf.chandef);
if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) { if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) {
ath_err(common, "Unable to set channel\n"); ath_err(common, "Unable to set channel\n");
ret = -EINVAL; ret = -EINVAL;
......
...@@ -802,7 +802,7 @@ static void ath9k_init_band_txpower(struct ath_softc *sc, int band) ...@@ -802,7 +802,7 @@ static void ath9k_init_band_txpower(struct ath_softc *sc, int band)
chan = &sband->channels[i]; chan = &sband->channels[i];
ah->curchan = &ah->channels[chan->hw_value]; ah->curchan = &ah->channels[chan->hw_value];
cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_HT20); cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_HT20);
ath9k_cmn_update_ichannel(ah->curchan, &chandef); ath9k_cmn_get_channel(sc->hw, ah, &chandef);
ath9k_hw_set_txpowerlimit(ah, MAX_RATE_POWER, true); ath9k_hw_set_txpowerlimit(ah, MAX_RATE_POWER, true);
} }
} }
......
...@@ -601,7 +601,7 @@ static int ath9k_start(struct ieee80211_hw *hw) ...@@ -601,7 +601,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
ath9k_ps_wakeup(sc); ath9k_ps_wakeup(sc);
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
init_channel = ath9k_cmn_get_curchannel(hw, ah); init_channel = ath9k_cmn_get_channel(hw, ah, &hw->conf.chandef);
/* Reset SERDES registers */ /* Reset SERDES registers */
ath9k_hw_configpcipowersave(ah, false); ath9k_hw_configpcipowersave(ah, false);
...@@ -804,7 +804,7 @@ static void ath9k_stop(struct ieee80211_hw *hw) ...@@ -804,7 +804,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)
} }
if (!ah->curchan) if (!ah->curchan)
ah->curchan = ath9k_cmn_get_curchannel(hw, ah); ah->curchan = ath9k_cmn_get_channel(hw, ah, &hw->conf.chandef);
ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
ath9k_hw_phy_disable(ah); ath9k_hw_phy_disable(ah);
...@@ -1224,8 +1224,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) ...@@ -1224,8 +1224,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
ath_update_survey_stats(sc); ath_update_survey_stats(sc);
spin_unlock_irqrestore(&common->cc_lock, flags); spin_unlock_irqrestore(&common->cc_lock, flags);
ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos], ath9k_cmn_get_channel(hw, ah, &conf->chandef);
&conf->chandef);
/* /*
* If the operating channel changes, change the survey in-use flags * If the operating channel changes, change the survey in-use flags
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment