summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Vossen <rvossen@broadcom.com>2010-12-24 14:17:40 (GMT)
committerGreg Kroah-Hartman <gregkh@suse.de>2011-01-20 23:20:33 (GMT)
commit1b1d36b6e8df93b1ddba81c6b72f0c22be6ed4ef (patch)
tree854a1f1ed8d0fd2305167fd4e2e1ba8643742876
parenta44d42367fe73e7720d309c4bde5ac79a6cd64a7 (diff)
downloadlinux-1b1d36b6e8df93b1ddba81c6b72f0c22be6ed4ef.tar.xz
staging: brcm80211: replaced 2.4Ghz specific wf_channel2mhz()
2.4 Ghz code cleanup related. Replaced broadcom specific function with Linux function ieee80211_dsss_chan_to_freq(). Reviewed-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/brcm80211/brcmfmac/wl_iw.c38
-rw-r--r--drivers/staging/brcm80211/sys/wlc_mac80211.c2
-rw-r--r--drivers/staging/brcm80211/util/bcmwifi.c5
3 files changed, 24 insertions, 21 deletions
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_iw.c b/drivers/staging/brcm80211/brcmfmac/wl_iw.c
index eed40fa..ad16732 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_iw.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_iw.c
@@ -30,7 +30,7 @@
#include <dngl_stats.h>
#include <dhd.h>
#include <dhdioctl.h>
-
+#include <linux/ieee80211.h>
typedef const struct si_pub si_t;
#include <wlioctl.h>
@@ -529,12 +529,13 @@ wl_iw_get_range(struct net_device *dev,
range->freq[i].i = dtoh32(list->element[i]);
ch = dtoh32(list->element[i]);
- if (ch <= CH_MAX_2G_CHANNEL)
+ if (ch <= CH_MAX_2G_CHANNEL) {
sf = WF_CHAN_FACTOR_2_4_G;
- else
+ range->freq[i].m = ieee80211_dsss_chan_to_freq(ch);
+ } else {
sf = WF_CHAN_FACTOR_5_G;
-
- range->freq[i].m = wf_channel2mhz(ch, sf);
+ range->freq[i].m = wf_channel2mhz(ch, sf);
+ }
range->freq[i].e = 6;
}
range->num_frequency = range->num_channels = i;
@@ -1534,11 +1535,14 @@ wl_iw_get_scan_prep(wl_scan_results_t *list,
}
iwe.cmd = SIOCGIWFREQ;
- iwe.u.freq.m = wf_channel2mhz(CHSPEC_CHANNEL(bi->chanspec),
- CHSPEC_CHANNEL(bi->chanspec) <=
- CH_MAX_2G_CHANNEL ?
- WF_CHAN_FACTOR_2_4_G :
- WF_CHAN_FACTOR_5_G);
+
+ if (CHSPEC_CHANNEL(bi->chanspec) <= CH_MAX_2G_CHANNEL)
+ iwe.u.freq.m = ieee80211_dsss_chan_to_freq(
+ CHSPEC_CHANNEL(bi->chanspec));
+ else
+ iwe.u.freq.m = wf_channel2mhz(
+ CHSPEC_CHANNEL(bi->chanspec),
+ WF_CHAN_FACTOR_5_G);
iwe.u.freq.e = 6;
event =
IWE_STREAM_ADD_EVENT(info, event, end, &iwe,
@@ -1811,12 +1815,14 @@ wl_iw_iscan_get_scan(struct net_device *dev,
channel =
(bi->ctl_ch ==
0) ? CHSPEC_CHANNEL(bi->chanspec) : bi->ctl_ch;
- iwe.u.freq.m =
- wf_channel2mhz(channel,
- channel <=
- CH_MAX_2G_CHANNEL ?
- WF_CHAN_FACTOR_2_4_G :
- WF_CHAN_FACTOR_5_G);
+
+ if (channel <= CH_MAX_2G_CHANNEL)
+ iwe.u.freq.m =
+ ieee80211_dsss_chan_to_freq(channel);
+ else
+ iwe.u.freq.m = wf_channel2mhz(channel,
+ WF_CHAN_FACTOR_5_G);
+
iwe.u.freq.e = 6;
event =
IWE_STREAM_ADD_EVENT(info, event, end, &iwe,
diff --git a/drivers/staging/brcm80211/sys/wlc_mac80211.c b/drivers/staging/brcm80211/sys/wlc_mac80211.c
index 11b267d..4853286 100644
--- a/drivers/staging/brcm80211/sys/wlc_mac80211.c
+++ b/drivers/staging/brcm80211/sys/wlc_mac80211.c
@@ -6840,7 +6840,7 @@ prep_mac80211_status(struct wlc_info *wlc, d11rxhdr_t *rxh, struct sk_buff *p,
rx_status->freq = wf_channel2mhz(channel, WF_CHAN_FACTOR_5_G);
} else {
rx_status->band = IEEE80211_BAND_2GHZ;
- rx_status->freq = wf_channel2mhz(channel, WF_CHAN_FACTOR_2_4_G);
+ rx_status->freq = ieee80211_dsss_chan_to_freq(channel);
}
rx_status->signal = wlc_rxh->rssi; /* signal */
diff --git a/drivers/staging/brcm80211/util/bcmwifi.c b/drivers/staging/brcm80211/util/bcmwifi.c
index 81e54bd..fbed6c0 100644
--- a/drivers/staging/brcm80211/util/bcmwifi.c
+++ b/drivers/staging/brcm80211/util/bcmwifi.c
@@ -181,11 +181,8 @@ int wf_channel2mhz(uint ch, uint start_factor)
{
int freq;
- if ((start_factor == WF_CHAN_FACTOR_2_4_G && (ch < 1 || ch > 14)) ||
- (ch > 200))
+ if (ch > 200)
freq = -1;
- else if ((start_factor == WF_CHAN_FACTOR_2_4_G) && (ch == 14))
- freq = 2484;
else
freq = ch * 5 + start_factor / 2;