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 d6da356608fa46efe34a317bdda60c6680b65d7e..9415b71fa12d6177153c9465d88c2582166d67f1 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 54083a39c72494d80277bdc065fad31372bc4631..0c2ea136cfd5f002a5fd331c3dba3eea68a6d491 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 7902de172a384fd58ea1e8ee5aa149a4519d1dbb..e0c6c3afba27066255bd50558e30eda5ba88f01a 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 9dd9e64c2b0b1a69f11a6d40a5e0e2cbc84d8b22..eedd71f5506b3b2c4dbd4e19be070fe70ba4667a 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 bce77eeb31c0ac53b77a2cc1b7406e3c82fb16d5..eecfec7c4063e85cc29604187ce3b7647d8cbbe9 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 b5045c62de7e072506988719a41615ffd315c1ec..dc29844cce1f4e1c83377690e1d063d07db5ab69 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 e96a1bb12783db78efc0d07a2794599525f9f830..d3acdae7238128e0fe9d292a25bbd03a2c33ac32 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)" : "",