[PATCH 02/10] staging: brcm80211: replaced 5Ghz specific wf_channel2mhz()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Code cleanup related. Replaced broadcom specific function with Linux function
ieee80211_dsss_chan_to_freq().

Reviewed-by: Arend van Spriel <arend@xxxxxxxxxxxx>
Signed-off-by: Roland Vossen <rvossen@xxxxxxxxxxxx>
---
 drivers/staging/brcm80211/brcmfmac/wl_iw.c   |   19 +++++++++--------
 drivers/staging/brcm80211/include/bcmwifi.h  |   18 -----------------
 drivers/staging/brcm80211/sys/wlc_mac80211.c |    4 ++-
 drivers/staging/brcm80211/util/bcmwifi.c     |   27 --------------------------
 4 files changed, 13 insertions(+), 55 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/wl_iw.c b/drivers/staging/brcm80211/brcmfmac/wl_iw.c
index ad16732..9d5e2c5 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_iw.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_iw.c
@@ -489,7 +489,7 @@ wl_iw_get_range(struct net_device *dev,
 	wl_rateset_t rateset;
 	s8 *channels;
 	int error, i, k;
-	uint sf, ch;
+	uint ch;
 
 	int phytype;
 	int bw_cap = 0, sgi_tx = 0, nmode = 0;
@@ -530,11 +530,10 @@ wl_iw_get_range(struct net_device *dev,
 
 		ch = dtoh32(list->element[i]);
 		if (ch <= CH_MAX_2G_CHANNEL) {
-			sf = WF_CHAN_FACTOR_2_4_G;
 			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 = ieee80211_ofdm_chan_to_freq(
+						WF_CHAN_FACTOR_5_G/2, ch);
 		}
 		range->freq[i].e = 6;
 	}
@@ -1540,9 +1539,10 @@ wl_iw_get_scan_prep(wl_scan_results_t *list,
 			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.m = ieee80211_ofdm_chan_to_freq(
+						WF_CHAN_FACTOR_5_G/2,
+						CHSPEC_CHANNEL(bi->chanspec));
+
 		iwe.u.freq.e = 6;
 		event =
 		    IWE_STREAM_ADD_EVENT(info, event, end, &iwe,
@@ -1820,8 +1820,9 @@ wl_iw_iscan_get_scan(struct net_device *dev,
 				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.m = ieee80211_ofdm_chan_to_freq(
+							WF_CHAN_FACTOR_5_G/2,
+							channel);
 
 			iwe.u.freq.e = 6;
 			event =
diff --git a/drivers/staging/brcm80211/include/bcmwifi.h b/drivers/staging/brcm80211/include/bcmwifi.h
index 4067fba..4978df8 100644
--- a/drivers/staging/brcm80211/include/bcmwifi.h
+++ b/drivers/staging/brcm80211/include/bcmwifi.h
@@ -171,22 +171,4 @@ extern chanspec_t wf_chspec_ctlchspec(chanspec_t chspec);
  */
 extern int wf_mhz2channel(uint freq, uint start_factor);
 
-/*
- * Return the center frequency in MHz of the given channel and base frequency.
- * The channel number is interpreted relative to the given base frequency.
- *
- * The valid channel range is [1, 14] in the 2.4 GHz band and [0, 200] otherwise.
- * The base frequency is specified as (start_factor * 500 kHz).
- * Constants WF_CHAN_FACTOR_2_4_G, WF_CHAN_FACTOR_5_G are defined for
- * 2.4 GHz and 5 GHz bands.
- * The channel range of [1, 14] is only checked for a start_factor of
- * WF_CHAN_FACTOR_2_4_G (4814).
- * Odd start_factors produce channels on .5 MHz boundaries, in which case
- * the answer is rounded down to an integral MHz.
- * -1 is returned for an out of range channel.
- *
- * Reference 802.11 REVma, section 17.3.8.3, and 802.11B section 18.4.6.2
- */
-extern int wf_channel2mhz(uint channel, uint start_factor);
-
 #endif				/* _bcmwifi_h_ */
diff --git a/drivers/staging/brcm80211/sys/wlc_mac80211.c b/drivers/staging/brcm80211/sys/wlc_mac80211.c
index 4853286..49894b6 100644
--- a/drivers/staging/brcm80211/sys/wlc_mac80211.c
+++ b/drivers/staging/brcm80211/sys/wlc_mac80211.c
@@ -6837,7 +6837,9 @@ prep_mac80211_status(struct wlc_info *wlc, d11rxhdr_t *rxh, struct sk_buff *p,
 	/* XXX  Channel/badn needs to be filtered against whether we are single/dual band card */
 	if (channel > 14) {
 		rx_status->band = IEEE80211_BAND_5GHZ;
-		rx_status->freq = wf_channel2mhz(channel, WF_CHAN_FACTOR_5_G);
+		rx_status->freq = ieee80211_ofdm_chan_to_freq(
+					WF_CHAN_FACTOR_5_G/2, channel);
+
 	} else {
 		rx_status->band = IEEE80211_BAND_2GHZ;
 		rx_status->freq = ieee80211_dsss_chan_to_freq(channel);
diff --git a/drivers/staging/brcm80211/util/bcmwifi.c b/drivers/staging/brcm80211/util/bcmwifi.c
index fbed6c0..cb6f21a 100644
--- a/drivers/staging/brcm80211/util/bcmwifi.c
+++ b/drivers/staging/brcm80211/util/bcmwifi.c
@@ -161,30 +161,3 @@ int wf_mhz2channel(uint freq, uint start_factor)
 	return ch;
 }
 
-/*
- * Return the center frequency in MHz of the given channel and base frequency.
- * The channel number is interpreted relative to the given base frequency.
- *
- * The valid channel range is [1, 14] in the 2.4 GHz band and [0, 200] otherwise.
- * The base frequency is specified as (start_factor * 500 kHz).
- * Constants WF_CHAN_FACTOR_2_4_G, WF_CHAN_FACTOR_4_G, and WF_CHAN_FACTOR_5_G
- * are defined for 2.4 GHz, 4 GHz, and 5 GHz bands.
- * The channel range of [1, 14] is only checked for a start_factor of
- * WF_CHAN_FACTOR_2_4_G (4814 = 2407 * 2).
- * Odd start_factors produce channels on .5 MHz boundaries, in which case
- * the answer is rounded down to an integral MHz.
- * -1 is returned for an out of range channel.
- *
- * Reference 802.11 REVma, section 17.3.8.3, and 802.11B section 18.4.6.2
- */
-int wf_channel2mhz(uint ch, uint start_factor)
-{
-	int freq;
-
-	if (ch > 200)
-		freq = -1;
-	else
-		freq = ch * 5 + start_factor / 2;
-
-	return freq;
-}
-- 
1.7.1


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux