aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl4965-base.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-05-29 04:35:28 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-03 15:00:27 -0400
commit82a66bbbe96126ca1bc6bc5ded8e67f529bcdfa4 (patch)
tree4692159aca2dec162a5e471ba1e2438a1ef59c1d /drivers/net/wireless/iwlwifi/iwl4965-base.c
parentd2f18bfd9bc6b51c8bb72b272ecca902a88387d4 (diff)
iwlwifi: clean iwl4965_mac_config
This patch cleans up iwl4965_mac_config. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index e5e8ad829a92..c71daec8c746 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -1084,8 +1084,8 @@ static int iwl4965_scan_initiate(struct iwl_priv *priv)
1084} 1084}
1085 1085
1086 1086
1087static void iwl4965_set_flags_for_phymode(struct iwl_priv *priv, 1087static void iwl_set_flags_for_band(struct iwl_priv *priv,
1088 enum ieee80211_band band) 1088 enum ieee80211_band band)
1089{ 1089{
1090 if (band == IEEE80211_BAND_5GHZ) { 1090 if (band == IEEE80211_BAND_5GHZ) {
1091 priv->staging_rxon.flags &= 1091 priv->staging_rxon.flags &=
@@ -1170,7 +1170,7 @@ static void iwl4965_connection_init_rx_config(struct iwl_priv *priv)
1170 priv->staging_rxon.channel = cpu_to_le16(ch_info->channel); 1170 priv->staging_rxon.channel = cpu_to_le16(ch_info->channel);
1171 priv->band = ch_info->band; 1171 priv->band = ch_info->band;
1172 1172
1173 iwl4965_set_flags_for_phymode(priv, priv->band); 1173 iwl_set_flags_for_band(priv, priv->band);
1174 1174
1175 priv->staging_rxon.ofdm_basic_rates = 1175 priv->staging_rxon.ofdm_basic_rates =
1176 (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 1176 (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
@@ -3823,6 +3823,7 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
3823 const struct iwl_channel_info *ch_info; 3823 const struct iwl_channel_info *ch_info;
3824 unsigned long flags; 3824 unsigned long flags;
3825 int ret = 0; 3825 int ret = 0;
3826 u16 channel;
3826 3827
3827 mutex_lock(&priv->mutex); 3828 mutex_lock(&priv->mutex);
3828 IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel->hw_value); 3829 IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel->hw_value);
@@ -3843,22 +3844,21 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
3843 return 0; 3844 return 0;
3844 } 3845 }
3845 3846
3846 spin_lock_irqsave(&priv->lock, flags); 3847 channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
3847 3848 ch_info = iwl_get_channel_info(priv, conf->channel->band, channel);
3848 ch_info = iwl_get_channel_info(priv, conf->channel->band,
3849 ieee80211_frequency_to_channel(conf->channel->center_freq));
3850 if (!is_channel_valid(ch_info)) { 3849 if (!is_channel_valid(ch_info)) {
3851 IWL_DEBUG_MAC80211("leave - invalid channel\n"); 3850 IWL_DEBUG_MAC80211("leave - invalid channel\n");
3852 spin_unlock_irqrestore(&priv->lock, flags);
3853 ret = -EINVAL; 3851 ret = -EINVAL;
3854 goto out; 3852 goto out;
3855 } 3853 }
3856 3854
3855 spin_lock_irqsave(&priv->lock, flags);
3856
3857#ifdef CONFIG_IWL4965_HT 3857#ifdef CONFIG_IWL4965_HT
3858 /* if we are switching from ht to 2.4 clear flags 3858 /* if we are switching from ht to 2.4 clear flags
3859 * from any ht related info since 2.4 does not 3859 * from any ht related info since 2.4 does not
3860 * support ht */ 3860 * support ht */
3861 if ((le16_to_cpu(priv->staging_rxon.channel) != conf->channel->hw_value) 3861 if ((le16_to_cpu(priv->staging_rxon.channel) != channel)
3862#ifdef IEEE80211_CONF_CHANNEL_SWITCH 3862#ifdef IEEE80211_CONF_CHANNEL_SWITCH
3863 && !(conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) 3863 && !(conf->flags & IEEE80211_CONF_CHANNEL_SWITCH)
3864#endif 3864#endif
@@ -3866,10 +3866,9 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
3866 priv->staging_rxon.flags = 0; 3866 priv->staging_rxon.flags = 0;
3867#endif /* CONFIG_IWL4965_HT */ 3867#endif /* CONFIG_IWL4965_HT */
3868 3868
3869 iwl_set_rxon_channel(priv, conf->channel->band, 3869 iwl_set_rxon_channel(priv, conf->channel->band, channel);
3870 ieee80211_frequency_to_channel(conf->channel->center_freq));
3871 3870
3872 iwl4965_set_flags_for_phymode(priv, conf->channel->band); 3871 iwl_set_flags_for_band(priv, conf->channel->band);
3873 3872
3874 /* The list of supported rates and rate mask can be different 3873 /* The list of supported rates and rate mask can be different
3875 * for each band; since the band may have changed, reset 3874 * for each band; since the band may have changed, reset