iwlwifi: do not call ieee80211_frequency_to_channel
authorShanyu Zhao <shanyu.zhao@intel.com>
Wed, 28 Jul 2010 20:40:27 +0000 (13:40 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 24 Aug 2010 20:32:01 +0000 (16:32 -0400)
A few cases in iwlwifi driver function ieee80211_frequency_to_channel()
is called to get channel number from center frequency. This is not needed
since the channel number is already saved in hw_value field of struct
ieee80211_channel in function iwlcore_init_geos(). So replace those function
calls with hw_value field of struct ieee80211_channel.

Signed-off-by: Shanyu Zhao <shanyu.zhao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-6000.c
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-debugfs.c

index d6da356..9415b71 100644 (file)
@@ -1470,7 +1470,7 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
 
        cmd.band = band;
        cmd.expect_beacon = 0;
-       ch = ieee80211_frequency_to_channel(ch_switch->channel->center_freq);
+       ch = ch_switch->channel->hw_value;
        cmd.channel = cpu_to_le16(ch);
        cmd.rxon_flags = priv->staging_rxon.flags;
        cmd.rxon_filter_flags = priv->staging_rxon.filter_flags;
index 54083a3..0c2ea13 100644 (file)
@@ -291,7 +291,7 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
        };
 
        cmd.band = priv->band == IEEE80211_BAND_2GHZ;
-       ch = ieee80211_frequency_to_channel(ch_switch->channel->center_freq);
+       ch = ch_switch->channel->hw_value;
        IWL_DEBUG_11H(priv, "channel switch from %d to %d\n",
                priv->active_rxon.channel, ch);
        cmd.channel = cpu_to_le16(ch);
index 7902de1..e0c6c3a 100644 (file)
@@ -214,7 +214,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
        };
 
        cmd.band = priv->band == IEEE80211_BAND_2GHZ;
-       ch = ieee80211_frequency_to_channel(ch_switch->channel->center_freq);
+       ch = ch_switch->channel->hw_value;
        IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
                      priv->active_rxon.channel, ch);
        cmd.channel = cpu_to_le16(ch);
index 9dd9e64..eedd71f 100644 (file)
@@ -1098,7 +1098,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
                if (chan->band != band)
                        continue;
 
-               channel = ieee80211_frequency_to_channel(chan->center_freq);
+               channel = chan->hw_value;
                scan_ch->channel = cpu_to_le16(channel);
 
                ch_info = iwl_get_channel_info(priv, band, channel);
index bce77ee..eecfec7 100644 (file)
@@ -3655,8 +3655,7 @@ static void iwl_mac_channel_switch(struct ieee80211_hw *hw,
        mutex_lock(&priv->mutex);
        if (priv->cfg->ops->lib->set_channel_switch) {
 
-               ch = ieee80211_frequency_to_channel(
-                       ch_switch->channel->center_freq);
+               ch = ch_switch->channel->hw_value;
                if (le16_to_cpu(priv->active_rxon.channel) != ch) {
                        ch_info = iwl_get_channel_info(priv,
                                                       conf->channel->band,
index b5045c6..dc29844 100644 (file)
@@ -916,7 +916,7 @@ EXPORT_SYMBOL(iwl_get_single_channel_number);
 int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch)
 {
        enum ieee80211_band band = ch->band;
-       u16 channel = ieee80211_frequency_to_channel(ch->center_freq);
+       u16 channel = ch->hw_value;
 
        if (!iwl_get_channel_info(priv, band, channel)) {
                IWL_DEBUG_INFO(priv, "Could not set channel to %d [%d]\n",
@@ -2032,7 +2032,7 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
                if (scan_active)
                        goto set_ch_out;
 
-               ch = ieee80211_frequency_to_channel(conf->channel->center_freq);
+               ch = conf->channel->hw_value;
                ch_info = iwl_get_channel_info(priv, conf->channel->band, ch);
                if (!is_channel_valid(ch_info)) {
                        IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n");
index e96a1bb..d3acdae 100644 (file)
@@ -467,8 +467,7 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
                for (i = 0; i < supp_band->n_channels; i++)
                        pos += scnprintf(buf + pos, bufsz - pos,
                                        "%d: %ddBm: BSS%s%s, %s.\n",
-                                       ieee80211_frequency_to_channel(
-                                       channels[i].center_freq),
+                                       channels[i].hw_value,
                                        channels[i].max_power,
                                        channels[i].flags & IEEE80211_CHAN_RADAR ?
                                        " (IEEE 802.11h required)" : "",
@@ -491,8 +490,7 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
                for (i = 0; i < supp_band->n_channels; i++)
                        pos += scnprintf(buf + pos, bufsz - pos,
                                        "%d: %ddBm: BSS%s%s, %s.\n",
-                                       ieee80211_frequency_to_channel(
-                                       channels[i].center_freq),
+                                       channels[i].hw_value,
                                        channels[i].max_power,
                                        channels[i].flags & IEEE80211_CHAN_RADAR ?
                                        " (IEEE 802.11h required)" : "",