All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] api clean: ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}
@ 2014-02-18 13:35 Zhao, Gang
  2014-02-18 13:35 ` [PATCH 1/7] airo: replace function " Zhao, Gang
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Zhao, Gang @ 2014-02-18 13:35 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

This patch set's purpose is to remove function
ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}, by replacing them
with more generic function ieee80211_{channel_to_frequency,
frequency_to_channel}.

The error number they return is different. the 'dsss' one return -1,
the other return zero. Fortunately most of the code have correct error
check to handle both situation. Good luck to those code which never
check the return value.

By the way, this patch set only compile tested.

Zhao, Gang (7):
  airo: replace function ieee80211_{dsss_chan_to_freq,
    freq_to_dsss_chan}
  atmel: replace function ieee80211_{dsss_chan_to_freq,
    freq_to_dsss_chan}
  wl3501_cs: replace function ieee80211_{dsss_chan_to_freq,
    freq_to_dsss_chan}
  rndis_wlan: replace function ieee80211_{dsss_chan_to_freq,
    freq_to_dsss_chan}
  zd1201: replace function ieee80211_{dsss_chan_to_freq,
    freq_to_dsss_chan}
  orinoco: replace function ieee80211_{dsss_chan_to_freq,
    freq_to_dsss_chan}
  ieee80211: remove function ieee80211_{dsss_chan_to_freq,
    freq_to_dsss_chan}

 drivers/net/wireless/airo.c         | 13 ++++++++-----
 drivers/net/wireless/atmel.c        |  8 ++++----
 drivers/net/wireless/orinoco/cfg.c  |  4 ++--
 drivers/net/wireless/orinoco/hw.c   |  2 +-
 drivers/net/wireless/orinoco/scan.c |  5 +++--
 drivers/net/wireless/orinoco/wext.c |  2 +-
 drivers/net/wireless/rndis_wlan.c   |  3 ++-
 drivers/net/wireless/wl3501_cs.c    |  5 +++--
 drivers/net/wireless/zd1201.c       |  9 +++------
 include/linux/ieee80211.h           | 36 ------------------------------------
 10 files changed, 27 insertions(+), 60 deletions(-)

-- 
1.8.5.3


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/7] airo: replace function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}
  2014-02-18 13:35 [PATCH 0/7] api clean: ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} Zhao, Gang
@ 2014-02-18 13:35 ` Zhao, Gang
  2014-02-18 13:35 ` [PATCH 2/7] atmel: " Zhao, Gang
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Zhao, Gang @ 2014-02-18 13:35 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

Replace ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} with more
generic ieee80211_{channel_to_frequency, frequency_to_channel}.

Include <net/cfg80211.h> for the defination of IEEE80211_BAND_2GHZ.
Because <net/cfg80211.h> includes <linux/ieee80211.h>, so we can
replace <linux/ieee80211.h> with <net/cfg80211.h>.

This change is a preparation for the removal of function
ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}.

Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
---
 drivers/net/wireless/airo.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index edf4b57..2e6cb64 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -49,7 +49,7 @@
 #include <linux/kthread.h>
 #include <linux/freezer.h>
 
-#include <linux/ieee80211.h>
+#include <net/cfg80211.h>
 #include <net/iw_handler.h>
 
 #include "airo.h"
@@ -5797,7 +5797,7 @@ static int airo_set_freq(struct net_device *dev,
 
 		/* Hack to fall through... */
 		fwrq->e = 0;
-		fwrq->m = ieee80211_freq_to_dsss_chan(f);
+		fwrq->m = ieee80211_frequency_to_channel(f);
 	}
 	/* Setting by channel number */
 	if((fwrq->m > 1000) || (fwrq->e > 0))
@@ -5841,7 +5841,8 @@ static int airo_get_freq(struct net_device *dev,
 
 	ch = le16_to_cpu(status_rid.channel);
 	if((ch > 0) && (ch < 15)) {
-		fwrq->m = ieee80211_dsss_chan_to_freq(ch) * 100000;
+		fwrq->m = 100000 *
+			ieee80211_channel_to_frequency(ch, IEEE80211_BAND_2GHZ);
 		fwrq->e = 1;
 	} else {
 		fwrq->m = ch;
@@ -6898,7 +6899,8 @@ static int airo_get_range(struct net_device *dev,
 	k = 0;
 	for(i = 0; i < 14; i++) {
 		range->freq[k].i = i + 1; /* List index */
-		range->freq[k].m = ieee80211_dsss_chan_to_freq(i + 1) * 100000;
+		range->freq[k].m = 100000 *
+		     ieee80211_channel_to_frequency(i + 1, IEEE80211_BAND_2GHZ);
 		range->freq[k++].e = 1;	/* Values in MHz -> * 10^5 * 10 */
 	}
 	range->num_frequency = k;
@@ -7297,7 +7299,8 @@ static inline char *airo_translate_scan(struct net_device *dev,
 	/* Add frequency */
 	iwe.cmd = SIOCGIWFREQ;
 	iwe.u.freq.m = le16_to_cpu(bss->dsChannel);
-	iwe.u.freq.m = ieee80211_dsss_chan_to_freq(iwe.u.freq.m) * 100000;
+	iwe.u.freq.m = 100000 *
+	      ieee80211_channel_to_frequency(iwe.u.freq.m, IEEE80211_BAND_2GHZ);
 	iwe.u.freq.e = 1;
 	current_ev = iwe_stream_add_event(info, current_ev, end_buf,
 					  &iwe, IW_EV_FREQ_LEN);
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/7] atmel: replace function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}
  2014-02-18 13:35 [PATCH 0/7] api clean: ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} Zhao, Gang
  2014-02-18 13:35 ` [PATCH 1/7] airo: replace function " Zhao, Gang
@ 2014-02-18 13:35 ` Zhao, Gang
  2014-02-18 13:35 ` [PATCH 3/7] wl3501_cs: " Zhao, Gang
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Zhao, Gang @ 2014-02-18 13:35 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, Simon Kelley

Replace ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} with more
generic ieee80211_{channel_to_frequency, frequency_to_channel}.

Include <net/cfg80211.h> for the defination of IEEE80211_BAND_2GHZ.
Because <net/cfg80211.h> includes <linux/ieee80211.h>, so we can
replace <linux/ieee80211.h> with <net/cfg80211.h>.

This change is a preparation for the removal of function
ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}.

Cc: Simon Kelley <simon@thekelleys.org.uk>
Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
---
 drivers/net/wireless/atmel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index bf93ea8..1fe41af 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -67,7 +67,7 @@
 #include <linux/moduleparam.h>
 #include <linux/firmware.h>
 #include <linux/jiffies.h>
-#include <linux/ieee80211.h>
+#include <net/cfg80211.h>
 #include "atmel.h"
 
 #define DRIVER_MAJOR 0
@@ -2273,7 +2273,7 @@ static int atmel_set_freq(struct net_device *dev,
 
 		/* Hack to fall through... */
 		fwrq->e = 0;
-		fwrq->m = ieee80211_freq_to_dsss_chan(f);
+		fwrq->m = ieee80211_frequency_to_channel(f);
 	}
 	/* Setting by channel number */
 	if ((fwrq->m > 1000) || (fwrq->e > 0))
@@ -2434,8 +2434,8 @@ static int atmel_get_range(struct net_device *dev,
 			range->freq[k].i = i; /* List index */
 
 			/* Values in MHz -> * 10^5 * 10 */
-			range->freq[k].m = (ieee80211_dsss_chan_to_freq(i) *
-					    100000);
+			range->freq[k].m = 100000 *
+			 ieee80211_channel_to_frequency(i, IEEE80211_BAND_2GHZ);
 			range->freq[k++].e = 1;
 		}
 		range->num_frequency = k;
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/7] wl3501_cs: replace function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}
  2014-02-18 13:35 [PATCH 0/7] api clean: ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} Zhao, Gang
  2014-02-18 13:35 ` [PATCH 1/7] airo: replace function " Zhao, Gang
  2014-02-18 13:35 ` [PATCH 2/7] atmel: " Zhao, Gang
@ 2014-02-18 13:35 ` Zhao, Gang
  2014-02-18 13:36 ` [PATCH 4/7] rndis_wlan: " Zhao, Gang
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Zhao, Gang @ 2014-02-18 13:35 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, Arnaldo Carvalho de Melo

Replace ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} with more
generic ieee80211_{channel_to_frequency, frequency_to_channel}.

Include <net/cfg80211.h> for the defination of IEEE80211_BAND_2GHZ.
Because <net/cfg80211.h> includes <linux/ieee80211.h>, so we can
replace <linux/ieee80211.h> with <net/cfg80211.h>.

This change is a preparation for the removal of function
ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}.

Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
---
 drivers/net/wireless/wl3501_cs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index d24d4a9..5c33744 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -42,7 +42,7 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/wireless.h>
-#include <linux/ieee80211.h>
+#include <net/cfg80211.h>
 #include <linux/etherdevice.h>
 
 #include <net/iw_handler.h>
@@ -1454,7 +1454,8 @@ static int wl3501_get_freq(struct net_device *dev, struct iw_request_info *info,
 {
 	struct wl3501_card *this = netdev_priv(dev);
 
-	wrqu->freq.m = ieee80211_dsss_chan_to_freq(this->chan) * 100000;
+	wrqu->freq.m = 100000 *
+		ieee80211_channel_to_frequency(this->chan, IEEE80211_BAND_2GHZ);
 	wrqu->freq.e = 1;
 	return 0;
 }
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/7] rndis_wlan: replace function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}
  2014-02-18 13:35 [PATCH 0/7] api clean: ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} Zhao, Gang
                   ` (2 preceding siblings ...)
  2014-02-18 13:35 ` [PATCH 3/7] wl3501_cs: " Zhao, Gang
@ 2014-02-18 13:36 ` Zhao, Gang
  2014-02-18 13:36 ` [PATCH 5/7] zd1201: " Zhao, Gang
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Zhao, Gang @ 2014-02-18 13:36 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, Jussi Kivilinna

Replace ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} with more
generic ieee80211_{channel_to_frequency, frequency_to_channel}.

File <net/cfg80211.h> has already been included. It's safe to use
IEEE80211_BAND_2GHZ here.

This change is a preparation for the removal of function
ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}.

Cc: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
---
 drivers/net/wireless/rndis_wlan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 2e89a86..39d22a1 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -1290,7 +1290,8 @@ static int set_channel(struct usbnet *usbdev, int channel)
 	if (is_associated(usbdev))
 		return 0;
 
-	dsconfig = ieee80211_dsss_chan_to_freq(channel) * 1000;
+	dsconfig = 1000 *
+		ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
 
 	len = sizeof(config);
 	ret = rndis_query_oid(usbdev,
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/7] zd1201: replace function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}
  2014-02-18 13:35 [PATCH 0/7] api clean: ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} Zhao, Gang
                   ` (3 preceding siblings ...)
  2014-02-18 13:36 ` [PATCH 4/7] rndis_wlan: " Zhao, Gang
@ 2014-02-18 13:36 ` Zhao, Gang
  2014-02-18 13:36 ` [PATCH 6/7] orinoco: " Zhao, Gang
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Zhao, Gang @ 2014-02-18 13:36 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

Replace ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} with more
generic ieee80211_{channel_to_frequency, frequency_to_channel}.

Function ieee80211_frequency_to_channel() will return 0 if frequency
is not correctly provided, so no need to set channel to 0 explicitly.

Include <net/cfg80211.h> for the defination of IEEE80211_BAND_2GHZ.
Because <net/cfg80211.h> includes <linux/ieee80211.h>, so we can
replace <linux/ieee80211.h> with <net/cfg80211.h>.

This change is a preparation for the removal of function
ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}.

Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
---
 drivers/net/wireless/zd1201.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c
index d39c417..6f5c793 100644
--- a/drivers/net/wireless/zd1201.c
+++ b/drivers/net/wireless/zd1201.c
@@ -18,7 +18,7 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/wireless.h>
-#include <linux/ieee80211.h>
+#include <net/cfg80211.h>
 #include <net/iw_handler.h>
 #include <linux/string.h>
 #include <linux/if_arp.h>
@@ -914,11 +914,8 @@ static int zd1201_set_freq(struct net_device *dev,
 
 	if (freq->e == 0)
 		channel = freq->m;
-	else {
-		channel = ieee80211_freq_to_dsss_chan(freq->m);
-		if (channel < 0)
-			channel = 0;
-	}
+	else
+		channel = ieee80211_frequency_to_channel(freq->m);
 
 	err = zd1201_setconfig16(zd, ZD1201_RID_CNFOWNCHANNEL, channel);
 	if (err)
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/7] orinoco: replace function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}
  2014-02-18 13:35 [PATCH 0/7] api clean: ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} Zhao, Gang
                   ` (4 preceding siblings ...)
  2014-02-18 13:36 ` [PATCH 5/7] zd1201: " Zhao, Gang
@ 2014-02-18 13:36 ` Zhao, Gang
  2014-02-19  8:33   ` Dave Kilroy
  2014-02-18 13:36 ` [PATCH 7/7] ieee80211: remove " Zhao, Gang
  2014-02-19 11:00 ` [PATCH 0/7] api clean: " Johannes Berg
  7 siblings, 1 reply; 13+ messages in thread
From: Zhao, Gang @ 2014-02-18 13:36 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

Replace ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} with more
generic ieee80211_{channel_to_frequency, frequency_to_channel}.

File <net/cfg80211.h> has already been included. It's safe to use
IEEE80211_BAND_2GHZ here.

This change is a preparation for the removal of function
ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}.

Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
---
 drivers/net/wireless/orinoco/cfg.c  | 4 ++--
 drivers/net/wireless/orinoco/hw.c   | 2 +-
 drivers/net/wireless/orinoco/scan.c | 5 +++--
 drivers/net/wireless/orinoco/wext.c | 2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c
index d01edd2..c5ef3ab 100644
--- a/drivers/net/wireless/orinoco/cfg.c
+++ b/drivers/net/wireless/orinoco/cfg.c
@@ -59,7 +59,7 @@ int orinoco_wiphy_register(struct wiphy *wiphy)
 	for (i = 0; i < NUM_CHANNELS; i++) {
 		if (priv->channel_mask & (1 << i)) {
 			priv->channels[i].center_freq =
-				ieee80211_dsss_chan_to_freq(i + 1);
+		     ieee80211_channel_to_frequency(i + 1, IEEE80211_BAND_2GHZ);
 			channels++;
 		}
 	}
@@ -177,7 +177,7 @@ static int orinoco_set_monitor_channel(struct wiphy *wiphy,
 	if (chandef->chan->band != IEEE80211_BAND_2GHZ)
 		return -EINVAL;
 
-	channel = ieee80211_freq_to_dsss_chan(chandef->chan->center_freq);
+	channel = ieee80211_frequency_to_channel(chandef->chan->center_freq);
 
 	if ((channel < 1) || (channel > NUM_CHANNELS) ||
 	     !(priv->channel_mask & (1 << (channel - 1))))
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c
index c09c843..49300d0 100644
--- a/drivers/net/wireless/orinoco/hw.c
+++ b/drivers/net/wireless/orinoco/hw.c
@@ -1193,7 +1193,7 @@ int orinoco_hw_get_freq(struct orinoco_private *priv)
 		goto out;
 
 	}
-	freq = ieee80211_dsss_chan_to_freq(channel);
+	freq = ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
 
  out:
 	orinoco_unlock(priv, &flags);
diff --git a/drivers/net/wireless/orinoco/scan.c b/drivers/net/wireless/orinoco/scan.c
index e8c5714..e175b9b 100644
--- a/drivers/net/wireless/orinoco/scan.c
+++ b/drivers/net/wireless/orinoco/scan.c
@@ -110,7 +110,8 @@ static void orinoco_add_hostscan_result(struct orinoco_private *priv,
 		break;
 	}
 
-	freq = ieee80211_dsss_chan_to_freq(le16_to_cpu(bss->a.channel));
+	freq = ieee80211_channel_to_frequency(
+		le16_to_cpu(bss->a.channel), IEEE80211_BAND_2GHZ);
 	channel = ieee80211_get_channel(wiphy, freq);
 	if (!channel) {
 		printk(KERN_DEBUG "Invalid channel designation %04X(%04X)",
@@ -146,7 +147,7 @@ void orinoco_add_extscan_result(struct orinoco_private *priv,
 	ie_len = len - sizeof(*bss);
 	ie = cfg80211_find_ie(WLAN_EID_DS_PARAMS, bss->data, ie_len);
 	chan = ie ? ie[2] : 0;
-	freq = ieee80211_dsss_chan_to_freq(chan);
+	freq = ieee80211_channel_to_frequency(chan, IEEE80211_BAND_2GHZ);
 	channel = ieee80211_get_channel(wiphy, freq);
 
 	timestamp = le64_to_cpu(bss->timestamp);
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c
index 3b5508f..b7a867b 100644
--- a/drivers/net/wireless/orinoco/wext.c
+++ b/drivers/net/wireless/orinoco/wext.c
@@ -444,7 +444,7 @@ static int orinoco_ioctl_setfreq(struct net_device *dev,
 		for (i = 0; i < (6 - frq->e); i++)
 			denom *= 10;
 
-		chan = ieee80211_freq_to_dsss_chan(frq->m / denom);
+		chan = ieee80211_frequency_to_channel(frq->m / denom);
 	}
 
 	if ((chan < 1) || (chan > NUM_CHANNELS) ||
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 7/7] ieee80211: remove function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}
  2014-02-18 13:35 [PATCH 0/7] api clean: ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} Zhao, Gang
                   ` (5 preceding siblings ...)
  2014-02-18 13:36 ` [PATCH 6/7] orinoco: " Zhao, Gang
@ 2014-02-18 13:36 ` Zhao, Gang
  2014-02-19  0:59   ` Zhao, Gang
  2014-02-19 11:00 ` [PATCH 0/7] api clean: " Johannes Berg
  7 siblings, 1 reply; 13+ messages in thread
From: Zhao, Gang @ 2014-02-18 13:36 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, Johannes Berg

Function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} have been
replaced with ieee80211_{channel_to_frequency, frequency_to_channel}.

There should be no users of the two functions now. So remove them.

Cc: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
---
 include/linux/ieee80211.h | 36 ------------------------------------
 1 file changed, 36 deletions(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 5f34935..0629904 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2308,42 +2308,6 @@ static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
 }
 
 /**
- * ieee80211_dsss_chan_to_freq - get channel center frequency
- * @channel: the DSSS channel
- *
- * Convert IEEE802.11 DSSS channel to the center frequency (MHz).
- * Ref IEEE 802.11-2007 section 15.6
- */
-static inline int ieee80211_dsss_chan_to_freq(int channel)
-{
-	if ((channel > 0) && (channel < 14))
-		return 2407 + (channel * 5);
-	else if (channel == 14)
-		return 2484;
-	else
-		return -1;
-}
-
-/**
- * ieee80211_freq_to_dsss_chan - get channel
- * @freq: the frequency
- *
- * Convert frequency (MHz) to IEEE802.11 DSSS channel
- * Ref IEEE 802.11-2007 section 15.6
- *
- * This routine selects the channel with the closest center frequency.
- */
-static inline int ieee80211_freq_to_dsss_chan(int freq)
-{
-	if ((freq >= 2410) && (freq < 2475))
-		return (freq - 2405) / 5;
-	else if ((freq >= 2482) && (freq < 2487))
-		return 14;
-	else
-		return -1;
-}
-
-/**
  * ieee80211_tu_to_usec - convert time units (TU) to microseconds
  * @tu: the TUs
  */
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 7/7] ieee80211: remove function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}
  2014-02-18 13:36 ` [PATCH 7/7] ieee80211: remove " Zhao, Gang
@ 2014-02-19  0:59   ` Zhao, Gang
  2014-02-28 18:58     ` John W. Linville
  0 siblings, 1 reply; 13+ messages in thread
From: Zhao, Gang @ 2014-02-19  0:59 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, Johannes Berg

On Tue, 2014-02-18 at 21:36:03 +0800, Zhao, Gang wrote:
> Function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} have been
> replaced with ieee80211_{channel_to_frequency, frequency_to_channel}.
>
> There should be no users of the two functions now. So remove them.
>
> Cc: Johannes Berg <johannes.berg@intel.com>
> Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
> ---

Since staging driver wlan-ng uses function ieee80211_dsss_chan_to_freq,
This patch "ieee80211: remove function ieee80211_{dsss_chan_to_freq,
freq_to_dsss_chan}" should be applied later, when that staging-next
patch "staging: wlan-ng: replace function ieee80211_dsss_chan_to_freq()"
appear on wireless-next.

>  include/linux/ieee80211.h | 36 ------------------------------------ 1
>  file changed, 36 deletions(-)
>
> diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
> index 5f34935..0629904 100644
> --- a/include/linux/ieee80211.h
> +++ b/include/linux/ieee80211.h
> @@ -2308,42 +2308,6 @@ static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
>  }
>  
>  /**
> - * ieee80211_dsss_chan_to_freq - get channel center frequency
> - * @channel: the DSSS channel
> - *
> - * Convert IEEE802.11 DSSS channel to the center frequency (MHz).
> - * Ref IEEE 802.11-2007 section 15.6
> - */
> -static inline int ieee80211_dsss_chan_to_freq(int channel)
> -{
> -	if ((channel > 0) && (channel < 14))
> -		return 2407 + (channel * 5);
> -	else if (channel == 14)
> -		return 2484;
> -	else
> -		return -1;
> -}
> -
> -/**
> - * ieee80211_freq_to_dsss_chan - get channel
> - * @freq: the frequency
> - *
> - * Convert frequency (MHz) to IEEE802.11 DSSS channel
> - * Ref IEEE 802.11-2007 section 15.6
> - *
> - * This routine selects the channel with the closest center frequency.
> - */
> -static inline int ieee80211_freq_to_dsss_chan(int freq)
> -{
> -	if ((freq >= 2410) && (freq < 2475))
> -		return (freq - 2405) / 5;
> -	else if ((freq >= 2482) && (freq < 2487))
> -		return 14;
> -	else
> -		return -1;
> -}
> -
> -/**
>   * ieee80211_tu_to_usec - convert time units (TU) to microseconds
>   * @tu: the TUs
>   */

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/7] orinoco: replace function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}
  2014-02-18 13:36 ` [PATCH 6/7] orinoco: " Zhao, Gang
@ 2014-02-19  8:33   ` Dave Kilroy
  2014-02-19  8:58     ` [PATCH 6/7 v2] " Zhao, Gang
  0 siblings, 1 reply; 13+ messages in thread
From: Dave Kilroy @ 2014-02-19  8:33 UTC (permalink / raw)
  To: Zhao, Gang, John W. Linville; +Cc: linux-wireless

On 18/02/2014 13:36, Zhao, Gang wrote:
> Replace ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} with more
> generic ieee80211_{channel_to_frequency, frequency_to_channel}.
>
> File <net/cfg80211.h> has already been included. It's safe to use
> IEEE80211_BAND_2GHZ here.
>
> This change is a preparation for the removal of function
> ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}.
>
> Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
> ---
>   drivers/net/wireless/orinoco/cfg.c  | 4 ++--
>   drivers/net/wireless/orinoco/hw.c   | 2 +-
>   drivers/net/wireless/orinoco/scan.c | 5 +++--
>   drivers/net/wireless/orinoco/wext.c | 2 +-
>   4 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c
> index d01edd2..c5ef3ab 100644
> --- a/drivers/net/wireless/orinoco/cfg.c
> +++ b/drivers/net/wireless/orinoco/cfg.c
> @@ -59,7 +59,7 @@ int orinoco_wiphy_register(struct wiphy *wiphy)
>   	for (i = 0; i < NUM_CHANNELS; i++) {
>   		if (priv->channel_mask & (1 << i)) {
>   			priv->channels[i].center_freq =
> -				ieee80211_dsss_chan_to_freq(i + 1);
> +		     ieee80211_channel_to_frequency(i + 1, IEEE80211_BAND_2GHZ);
>   			channels++;
>   		}
Can you tweak that indentation so that it doesn't unindent here. If it 
has to be on one line I'd prefer to exceed 80 chars than back indent.


Thanks,

Dave.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 6/7 v2] orinoco: replace function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}
  2014-02-19  8:33   ` Dave Kilroy
@ 2014-02-19  8:58     ` Zhao, Gang
  0 siblings, 0 replies; 13+ messages in thread
From: Zhao, Gang @ 2014-02-19  8:58 UTC (permalink / raw)
  To: Dave Kilroy; +Cc: John W. Linville, linux-wireless

Replace ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} with more
generic ieee80211_{channel_to_frequency, frequency_to_channel}.

File <net/cfg80211.h> has already been included. It's safe to use
IEEE80211_BAND_2GHZ here.

This change is a preparation for the removal of function
ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}.

Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
---

v2: indention change suggested by Dave Kilroy

 drivers/net/wireless/orinoco/cfg.c  | 5 +++--
 drivers/net/wireless/orinoco/hw.c   | 2 +-
 drivers/net/wireless/orinoco/scan.c | 5 +++--
 drivers/net/wireless/orinoco/wext.c | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c
index d01edd2..a9e94b6 100644
--- a/drivers/net/wireless/orinoco/cfg.c
+++ b/drivers/net/wireless/orinoco/cfg.c
@@ -59,7 +59,8 @@ int orinoco_wiphy_register(struct wiphy *wiphy)
 	for (i = 0; i < NUM_CHANNELS; i++) {
 		if (priv->channel_mask & (1 << i)) {
 			priv->channels[i].center_freq =
-				ieee80211_dsss_chan_to_freq(i + 1);
+				ieee80211_channel_to_frequency(i + 1,
+							   IEEE80211_BAND_2GHZ);
 			channels++;
 		}
 	}
@@ -177,7 +178,7 @@ static int orinoco_set_monitor_channel(struct wiphy *wiphy,
 	if (chandef->chan->band != IEEE80211_BAND_2GHZ)
 		return -EINVAL;
 
-	channel = ieee80211_freq_to_dsss_chan(chandef->chan->center_freq);
+	channel = ieee80211_frequency_to_channel(chandef->chan->center_freq);
 
 	if ((channel < 1) || (channel > NUM_CHANNELS) ||
 	     !(priv->channel_mask & (1 << (channel - 1))))
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c
index c09c843..49300d0 100644
--- a/drivers/net/wireless/orinoco/hw.c
+++ b/drivers/net/wireless/orinoco/hw.c
@@ -1193,7 +1193,7 @@ int orinoco_hw_get_freq(struct orinoco_private *priv)
 		goto out;
 
 	}
-	freq = ieee80211_dsss_chan_to_freq(channel);
+	freq = ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
 
  out:
 	orinoco_unlock(priv, &flags);
diff --git a/drivers/net/wireless/orinoco/scan.c b/drivers/net/wireless/orinoco/scan.c
index e8c5714..e175b9b 100644
--- a/drivers/net/wireless/orinoco/scan.c
+++ b/drivers/net/wireless/orinoco/scan.c
@@ -110,7 +110,8 @@ static void orinoco_add_hostscan_result(struct orinoco_private *priv,
 		break;
 	}
 
-	freq = ieee80211_dsss_chan_to_freq(le16_to_cpu(bss->a.channel));
+	freq = ieee80211_channel_to_frequency(
+		le16_to_cpu(bss->a.channel), IEEE80211_BAND_2GHZ);
 	channel = ieee80211_get_channel(wiphy, freq);
 	if (!channel) {
 		printk(KERN_DEBUG "Invalid channel designation %04X(%04X)",
@@ -146,7 +147,7 @@ void orinoco_add_extscan_result(struct orinoco_private *priv,
 	ie_len = len - sizeof(*bss);
 	ie = cfg80211_find_ie(WLAN_EID_DS_PARAMS, bss->data, ie_len);
 	chan = ie ? ie[2] : 0;
-	freq = ieee80211_dsss_chan_to_freq(chan);
+	freq = ieee80211_channel_to_frequency(chan, IEEE80211_BAND_2GHZ);
 	channel = ieee80211_get_channel(wiphy, freq);
 
 	timestamp = le64_to_cpu(bss->timestamp);
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c
index 3b5508f..b7a867b 100644
--- a/drivers/net/wireless/orinoco/wext.c
+++ b/drivers/net/wireless/orinoco/wext.c
@@ -444,7 +444,7 @@ static int orinoco_ioctl_setfreq(struct net_device *dev,
 		for (i = 0; i < (6 - frq->e); i++)
 			denom *= 10;
 
-		chan = ieee80211_freq_to_dsss_chan(frq->m / denom);
+		chan = ieee80211_frequency_to_channel(frq->m / denom);
 	}
 
 	if ((chan < 1) || (chan > NUM_CHANNELS) ||
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] api clean: ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}
  2014-02-18 13:35 [PATCH 0/7] api clean: ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} Zhao, Gang
                   ` (6 preceding siblings ...)
  2014-02-18 13:36 ` [PATCH 7/7] ieee80211: remove " Zhao, Gang
@ 2014-02-19 11:00 ` Johannes Berg
  7 siblings, 0 replies; 13+ messages in thread
From: Johannes Berg @ 2014-02-19 11:00 UTC (permalink / raw)
  To: Zhao, Gang; +Cc: John W. Linville, linux-wireless

On Tue, 2014-02-18 at 21:35 +0800, Zhao, Gang wrote:
> This patch set's purpose is to remove function
> ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}, by replacing them
> with more generic function ieee80211_{channel_to_frequency,
> frequency_to_channel}.

I'm fine with this, but I won't take the patches. John, please take
patch 7 as well as the rest if/when you decide to do so.

johannes


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 7/7] ieee80211: remove function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}
  2014-02-19  0:59   ` Zhao, Gang
@ 2014-02-28 18:58     ` John W. Linville
  0 siblings, 0 replies; 13+ messages in thread
From: John W. Linville @ 2014-02-28 18:58 UTC (permalink / raw)
  To: Zhao, Gang; +Cc: linux-wireless, Johannes Berg

On Wed, Feb 19, 2014 at 08:59:05AM +0800, Zhao, Gang wrote:
> On Tue, 2014-02-18 at 21:36:03 +0800, Zhao, Gang wrote:
> > Function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} have been
> > replaced with ieee80211_{channel_to_frequency, frequency_to_channel}.
> >
> > There should be no users of the two functions now. So remove them.
> >
> > Cc: Johannes Berg <johannes.berg@intel.com>
> > Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
> > ---
> 
> Since staging driver wlan-ng uses function ieee80211_dsss_chan_to_freq,
> This patch "ieee80211: remove function ieee80211_{dsss_chan_to_freq,
> freq_to_dsss_chan}" should be applied later, when that staging-next
> patch "staging: wlan-ng: replace function ieee80211_dsss_chan_to_freq()"
> appear on wireless-next.

I'm not particularly concerned about breaking drivers in staging...

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-02-28 19:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-18 13:35 [PATCH 0/7] api clean: ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} Zhao, Gang
2014-02-18 13:35 ` [PATCH 1/7] airo: replace function " Zhao, Gang
2014-02-18 13:35 ` [PATCH 2/7] atmel: " Zhao, Gang
2014-02-18 13:35 ` [PATCH 3/7] wl3501_cs: " Zhao, Gang
2014-02-18 13:36 ` [PATCH 4/7] rndis_wlan: " Zhao, Gang
2014-02-18 13:36 ` [PATCH 5/7] zd1201: " Zhao, Gang
2014-02-18 13:36 ` [PATCH 6/7] orinoco: " Zhao, Gang
2014-02-19  8:33   ` Dave Kilroy
2014-02-19  8:58     ` [PATCH 6/7 v2] " Zhao, Gang
2014-02-18 13:36 ` [PATCH 7/7] ieee80211: remove " Zhao, Gang
2014-02-19  0:59   ` Zhao, Gang
2014-02-28 18:58     ` John W. Linville
2014-02-19 11:00 ` [PATCH 0/7] api clean: " Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.