aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-27 06:01:50 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-29 15:46:14 -0400
commit0e82ffe3b90bcad72cfe80e4379946b8fb0691ca (patch)
treec6b73524d4db86ddcaa866d7ea81a9600b610413 /net/wireless
parenta7bc376c858e0e724b8cb2db09b6874562d377ca (diff)
cfg80211: combine iwfreq implementations
Until now we implemented iwfreq for managed mode, we needed to keep the implementations separate, but now that we have all versions implemented we can combine them and export just one handler. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/core.h3
-rw-r--r--net/wireless/ibss.c5
-rw-r--r--net/wireless/nl80211.c2
-rw-r--r--net/wireless/wext-compat.c54
-rw-r--r--net/wireless/wext-compat.h21
-rw-r--r--net/wireless/wext-sme.c5
6 files changed, 81 insertions, 9 deletions
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 4276b70cd975..6d903c1d721d 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -66,6 +66,9 @@ struct cfg80211_registered_device {
66 struct work_struct conn_work; 66 struct work_struct conn_work;
67 struct work_struct event_work; 67 struct work_struct event_work;
68 68
69 /* current channel */
70 struct ieee80211_channel *channel;
71
69#ifdef CONFIG_CFG80211_DEBUGFS 72#ifdef CONFIG_CFG80211_DEBUGFS
70 /* Debugfs entries */ 73 /* Debugfs entries */
71 struct wiphy_debugfsdentries { 74 struct wiphy_debugfsdentries {
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index 8b65e212ae49..de9ac49cd907 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -7,6 +7,7 @@
7#include <linux/etherdevice.h> 7#include <linux/etherdevice.h>
8#include <linux/if_arp.h> 8#include <linux/if_arp.h>
9#include <net/cfg80211.h> 9#include <net/cfg80211.h>
10#include "wext-compat.h"
10#include "nl80211.h" 11#include "nl80211.h"
11 12
12 13
@@ -312,8 +313,6 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
312 313
313 return err; 314 return err;
314} 315}
315/* temporary symbol - mark GPL - in the future the handler won't be */
316EXPORT_SYMBOL_GPL(cfg80211_ibss_wext_siwfreq);
317 316
318int cfg80211_ibss_wext_giwfreq(struct net_device *dev, 317int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
319 struct iw_request_info *info, 318 struct iw_request_info *info,
@@ -342,8 +341,6 @@ int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
342 /* no channel if not joining */ 341 /* no channel if not joining */
343 return -EINVAL; 342 return -EINVAL;
344} 343}
345/* temporary symbol - mark GPL - in the future the handler won't be */
346EXPORT_SYMBOL_GPL(cfg80211_ibss_wext_giwfreq);
347 344
348int cfg80211_ibss_wext_siwessid(struct net_device *dev, 345int cfg80211_ibss_wext_siwessid(struct net_device *dev,
349 struct iw_request_info *info, 346 struct iw_request_info *info,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c951eb2b07d5..0cd548267d4a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -757,6 +757,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
757 channel_type); 757 channel_type);
758 if (result) 758 if (result)
759 goto bad_res; 759 goto bad_res;
760
761 rdev->channel = chan;
760 } 762 }
761 763
762 changed = 0; 764 changed = 0;
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index c7351a98e660..fc2e7768967d 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -14,6 +14,7 @@
14#include <linux/etherdevice.h> 14#include <linux/etherdevice.h>
15#include <net/iw_handler.h> 15#include <net/iw_handler.h>
16#include <net/cfg80211.h> 16#include <net/cfg80211.h>
17#include "wext-compat.h"
17#include "core.h" 18#include "core.h"
18 19
19int cfg80211_wext_giwname(struct net_device *dev, 20int cfg80211_wext_giwname(struct net_device *dev,
@@ -300,7 +301,6 @@ struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
300 return ERR_PTR(-EINVAL); 301 return ERR_PTR(-EINVAL);
301 return chan; 302 return chan;
302} 303}
303EXPORT_SYMBOL_GPL(cfg80211_wext_freq);
304 304
305int cfg80211_wext_siwrts(struct net_device *dev, 305int cfg80211_wext_siwrts(struct net_device *dev,
306 struct iw_request_info *info, 306 struct iw_request_info *info,
@@ -759,6 +759,58 @@ int cfg80211_wext_giwencode(struct net_device *dev,
759} 759}
760EXPORT_SYMBOL_GPL(cfg80211_wext_giwencode); 760EXPORT_SYMBOL_GPL(cfg80211_wext_giwencode);
761 761
762int cfg80211_wext_siwfreq(struct net_device *dev,
763 struct iw_request_info *info,
764 struct iw_freq *freq, char *extra)
765{
766 struct wireless_dev *wdev = dev->ieee80211_ptr;
767 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
768 struct ieee80211_channel *chan;
769 int err;
770
771 switch (wdev->iftype) {
772 case NL80211_IFTYPE_STATION:
773 return cfg80211_mgd_wext_siwfreq(dev, info, freq, extra);
774 case NL80211_IFTYPE_ADHOC:
775 return cfg80211_ibss_wext_siwfreq(dev, info, freq, extra);
776 default:
777 chan = cfg80211_wext_freq(wdev->wiphy, freq);
778 if (!chan)
779 return -EINVAL;
780 if (IS_ERR(chan))
781 return PTR_ERR(chan);
782 err = rdev->ops->set_channel(wdev->wiphy, chan,
783 NL80211_CHAN_NO_HT);
784 if (err)
785 return err;
786 rdev->channel = chan;
787 return 0;
788 }
789}
790EXPORT_SYMBOL_GPL(cfg80211_wext_siwfreq);
791
792int cfg80211_wext_giwfreq(struct net_device *dev,
793 struct iw_request_info *info,
794 struct iw_freq *freq, char *extra)
795{
796 struct wireless_dev *wdev = dev->ieee80211_ptr;
797 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
798
799 switch (wdev->iftype) {
800 case NL80211_IFTYPE_STATION:
801 return cfg80211_mgd_wext_giwfreq(dev, info, freq, extra);
802 case NL80211_IFTYPE_ADHOC:
803 return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
804 default:
805 if (!rdev->channel)
806 return -EINVAL;
807 freq->m = rdev->channel->center_freq;
808 freq->e = 6;
809 return 0;
810 }
811}
812EXPORT_SYMBOL_GPL(cfg80211_wext_giwfreq);
813
762int cfg80211_wext_siwtxpower(struct net_device *dev, 814int cfg80211_wext_siwtxpower(struct net_device *dev,
763 struct iw_request_info *info, 815 struct iw_request_info *info,
764 union iwreq_data *data, char *extra) 816 union iwreq_data *data, char *extra)
diff --git a/net/wireless/wext-compat.h b/net/wireless/wext-compat.h
new file mode 100644
index 000000000000..23a6b5a83f2d
--- /dev/null
+++ b/net/wireless/wext-compat.h
@@ -0,0 +1,21 @@
1#ifndef __WEXT_COMPAT
2#define __WEXT_COMPAT
3
4int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
5 struct iw_request_info *info,
6 struct iw_freq *freq, char *extra);
7int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
8 struct iw_request_info *info,
9 struct iw_freq *freq, char *extra);
10
11int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
12 struct iw_request_info *info,
13 struct iw_freq *freq, char *extra);
14int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
15 struct iw_request_info *info,
16 struct iw_freq *freq, char *extra);
17
18struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
19 struct iw_freq *freq);
20
21#endif /* __WEXT_COMPAT */
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index 4c689fd865b0..509279a1cfb2 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -8,6 +8,7 @@
8#include <linux/etherdevice.h> 8#include <linux/etherdevice.h>
9#include <linux/if_arp.h> 9#include <linux/if_arp.h>
10#include <net/cfg80211.h> 10#include <net/cfg80211.h>
11#include "wext-compat.h"
11#include "nl80211.h" 12#include "nl80211.h"
12 13
13int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev, 14int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
@@ -108,8 +109,6 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
108 cfg80211_unlock_rdev(rdev); 109 cfg80211_unlock_rdev(rdev);
109 return err; 110 return err;
110} 111}
111/* temporary symbol - mark GPL - in the future the handler won't be */
112EXPORT_SYMBOL_GPL(cfg80211_mgd_wext_siwfreq);
113 112
114int cfg80211_mgd_wext_giwfreq(struct net_device *dev, 113int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
115 struct iw_request_info *info, 114 struct iw_request_info *info,
@@ -138,8 +137,6 @@ int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
138 /* no channel if not joining */ 137 /* no channel if not joining */
139 return -EINVAL; 138 return -EINVAL;
140} 139}
141/* temporary symbol - mark GPL - in the future the handler won't be */
142EXPORT_SYMBOL_GPL(cfg80211_mgd_wext_giwfreq);
143 140
144int cfg80211_mgd_wext_siwessid(struct net_device *dev, 141int cfg80211_mgd_wext_siwessid(struct net_device *dev,
145 struct iw_request_info *info, 142 struct iw_request_info *info,