iwlwifi: honour regulatory restrictions in scan code
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 4 Apr 2008 08:41:56 +0000 (10:41 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 8 Apr 2008 20:44:43 +0000 (16:44 -0400)
When doing firmware-assisted scanning, iwlwifi drivers do not
honour the regulatory control code that might disable channels
that are enabled in the EEPROM, for example when the user is
visiting another country and adjusted the regulatory domain
accordingly. This patch fixes that.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl3945-base.c
drivers/net/wireless/iwlwifi/iwl4965-base.c

index d4daa04465a3894a0adfb132ce672e614aff5990..5e51cfcda39f141b350066f3c512da401502513e 100644 (file)
@@ -4965,6 +4965,9 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv,
        passive_dwell = iwl3945_get_passive_dwell_time(priv, band);
 
        for (i = 0, added = 0; i < sband->n_channels; i++) {
+               if (channels[i].flags & IEEE80211_CHAN_DISABLED)
+                       continue;
+
                if (channels[i].hw_value ==
                    le16_to_cpu(priv->active_rxon.channel)) {
                        if (iwl3945_is_associated(priv)) {
index 4517e4ce3a25dc7058815c27a014b471c978fd00..b043871d53f12841328f616cf0780ab545fb41bf 100644 (file)
@@ -4794,6 +4794,9 @@ static int iwl4965_get_channels_for_scan(struct iwl_priv *priv,
        passive_dwell = iwl4965_get_passive_dwell_time(priv, band);
 
        for (i = 0, added = 0; i < sband->n_channels; i++) {
+               if (channels[i].flags & IEEE80211_CHAN_DISABLED)
+                       continue;
+
                if (ieee80211_frequency_to_channel(channels[i].center_freq) ==
                    le16_to_cpu(priv->active_rxon.channel)) {
                        if (iwl_is_associated(priv)) {