Linux wireless drivers development
 help / color / mirror / Atom feed
From: Wey-Yi Guy <wey-yi.w.guy@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
	ipw3945-devel@lists.sourceforge.net,
	Shanyu Zhao <shanyu.zhao@intel.com>,
	Johannes Berg <johannes.berg@intel.com>,
	Wey-Yi Guy <wey-yi.w.guy@intel.com>
Subject: [PATCH 05/16] iwlwifi: do not call ieee80211_frequency_to_channel
Date: Wed, 18 Aug 2010 09:22:40 -0700	[thread overview]
Message-ID: <1282148571-9258-6-git-send-email-wey-yi.w.guy@intel.com> (raw)
In-Reply-To: <1282148571-9258-1-git-send-email-wey-yi.w.guy@intel.com>

From: Shanyu Zhao <shanyu.zhao@intel.com>

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    |    2 +-
 drivers/net/wireless/iwlwifi/iwl-5000.c    |    2 +-
 drivers/net/wireless/iwlwifi/iwl-6000.c    |    2 +-
 drivers/net/wireless/iwlwifi/iwl-agn-lib.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl-agn.c     |    3 +--
 drivers/net/wireless/iwlwifi/iwl-core.c    |    4 ++--
 drivers/net/wireless/iwlwifi/iwl-debugfs.c |    6 ++----
 7 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index d92b729..f0a47f4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -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;
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 173f556..efd9e6b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -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);
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index a7af5e3..9e390f6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -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);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index 9dd9e64..eedd71f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -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);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index c8dec4a..00cbb83 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -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,
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 98cd710..221a211 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -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",
@@ -1987,7 +1987,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");
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index e96a1bb..d3acdae 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -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)" : "",
-- 
1.7.0.4


  parent reply	other threads:[~2010-08-18 16:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-18 16:22 [PATCH 00/16] iwlwifi update for 2.6.37 Wey-Yi Guy
2010-08-18 16:22 ` [PATCH 01/16] iwlwifi: remove unused define Wey-Yi Guy
2010-08-18 16:22 ` [PATCH 02/16] iwlwifi: additional comments in iwl_cfg Wey-Yi Guy
2010-08-18 16:22 ` [PATCH 03/16] iwlwifi: max/min aggregation time limit Wey-Yi Guy
2010-08-18 16:22 ` [PATCH 04/16] iwlwifi: make aggregation time limit configurable Wey-Yi Guy
2010-08-18 16:22 ` Wey-Yi Guy [this message]
2010-08-18 16:22 ` [PATCH 06/16] iwlwifi: avoid race condition in channel change Wey-Yi Guy
2010-08-18 16:22 ` [PATCH 07/16] iwlwifi: cleanup iwl_set_rxon_channel() Wey-Yi Guy
2010-08-18 16:22 ` [PATCH 08/16] iwlwifi: refactor iwl_setup_rxon_timing Wey-Yi Guy
2010-08-18 16:22 ` [PATCH 09/16] iwlagn: adjust starting action for rate scale Wey-Yi Guy
2010-08-18 16:22 ` [PATCH 10/16] iwlagn: continue perform rate scale when error detected Wey-Yi Guy
2010-08-18 16:22 ` [PATCH 11/16] iwlwifi: additional parameter in REPLY_RX_PHY_CMD Wey-Yi Guy
2010-08-18 16:22 ` [PATCH 12/16] iwlwifi: more generic name for rssi calc in iwlagn Wey-Yi Guy
2010-08-18 16:22 ` [PATCH 13/16] iwlwifi: configurable ampdu factor and density Wey-Yi Guy
2010-08-18 16:22 ` [PATCH 14/16] iwlwifi: remove unused iwl_send_card_state function Wey-Yi Guy
2010-08-18 16:22 ` [PATCH 15/16] iwlwifi: enable experimental ucode support Wey-Yi Guy
2010-08-18 16:22 ` [PATCH 16/16] iwlwifi: move debug options into submenu Wey-Yi Guy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1282148571-9258-6-git-send-email-wey-yi.w.guy@intel.com \
    --to=wey-yi.w.guy@intel.com \
    --cc=ipw3945-devel@lists.sourceforge.net \
    --cc=johannes.berg@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=shanyu.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox