[PATCH] bcm43xx: Fix 802.11b/g scan limits to match regulatory reqs

In 802.11b/g mode, bcm43xx actively scans channels 1-14 no matter what
locale has been set, either in the sprom or by the locale option. This
behaviorviolates regulatory rules everywhere in the world except
Japan. This patch changes the default range to the correct value if the
locale has been set, and to channels 1-13 if no locale has been set.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by Larry Finger and committed by John W. Linville 81e88006 92b3e2e9

+19 -1
+19 -1
drivers/net/wireless/bcm43xx/bcm43xx_main.c
··· 946 u8 channel; 947 struct bcm43xx_phyinfo *phy; 948 const char *iso_country; 949 950 geo = kzalloc(sizeof(*geo), GFP_KERNEL); 951 if (!geo) ··· 968 } 969 iso_country = bcm43xx_locale_iso(bcm->sprom.locale); 970 971 if (have_a) { 972 for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL; 973 channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) { ··· 996 } 997 if (have_bg) { 998 for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL; 999 - channel <= IEEE80211_24GHZ_MAX_CHANNEL; channel++) { 1000 chan = &geo->bg[i++]; 1001 chan->freq = bcm43xx_channel_to_freq_bg(channel); 1002 chan->channel = channel;
··· 946 u8 channel; 947 struct bcm43xx_phyinfo *phy; 948 const char *iso_country; 949 + u8 max_bg_channel; 950 951 geo = kzalloc(sizeof(*geo), GFP_KERNEL); 952 if (!geo) ··· 967 } 968 iso_country = bcm43xx_locale_iso(bcm->sprom.locale); 969 970 + /* set the maximum channel based on locale set in sprom or witle locale option */ 971 + switch (bcm->sprom.locale) { 972 + case BCM43xx_LOCALE_THAILAND: 973 + case BCM43xx_LOCALE_ISRAEL: 974 + case BCM43xx_LOCALE_JORDAN: 975 + case BCM43xx_LOCALE_USA_CANADA_ANZ: 976 + case BCM43xx_LOCALE_USA_LOW: 977 + max_bg_channel = 11; 978 + break; 979 + case BCM43xx_LOCALE_JAPAN: 980 + case BCM43xx_LOCALE_JAPAN_HIGH: 981 + max_bg_channel = 14; 982 + break; 983 + default: 984 + max_bg_channel = 13; 985 + } 986 + 987 if (have_a) { 988 for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL; 989 channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) { ··· 978 } 979 if (have_bg) { 980 for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL; 981 + channel <= max_bg_channel; channel++) { 982 chan = &geo->bg[i++]; 983 chan->freq = bcm43xx_channel_to_freq_bg(channel); 984 chan->channel = channel;