aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/wext-compat.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-11-08 15:25:48 -0500
committerJohannes Berg <johannes.berg@intel.com>2012-11-26 06:42:58 -0500
commit683b6d3b31a51956ea540df00abb0b78894924c1 (patch)
tree558e0f316b56368ab259755cb4eeaeb40331853d /net/wireless/wext-compat.c
parentfe4b31810c06cc6518fb193efb9b3c3289b55832 (diff)
cfg80211: pass a channel definition struct
Instead of passing a channel pointer and channel type to all functions and driver methods, pass a new channel definition struct. Right now, this struct contains just the control channel and channel type, but for VHT this will change. Also, add a small inline cfg80211_get_chandef_type() so that drivers don't need to use the _type field of the new structure all the time, which will change. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/wext-compat.c')
-rw-r--r--net/wireless/wext-compat.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 742ab6ec4c9d..da3307f32362 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -784,6 +784,9 @@ static int cfg80211_wext_siwfreq(struct net_device *dev,
784{ 784{
785 struct wireless_dev *wdev = dev->ieee80211_ptr; 785 struct wireless_dev *wdev = dev->ieee80211_ptr;
786 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); 786 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
787 struct cfg80211_chan_def chandef = {
788 ._type = NL80211_CHAN_NO_HT,
789 };
787 int freq, err; 790 int freq, err;
788 791
789 switch (wdev->iftype) { 792 switch (wdev->iftype) {
@@ -797,8 +800,11 @@ static int cfg80211_wext_siwfreq(struct net_device *dev,
797 return freq; 800 return freq;
798 if (freq == 0) 801 if (freq == 0)
799 return -EINVAL; 802 return -EINVAL;
803 chandef.chan = ieee80211_get_channel(&rdev->wiphy, freq);
804 if (!chandef.chan)
805 return -EINVAL;
800 mutex_lock(&rdev->devlist_mtx); 806 mutex_lock(&rdev->devlist_mtx);
801 err = cfg80211_set_monitor_channel(rdev, freq, NL80211_CHAN_NO_HT); 807 err = cfg80211_set_monitor_channel(rdev, &chandef);
802 mutex_unlock(&rdev->devlist_mtx); 808 mutex_unlock(&rdev->devlist_mtx);
803 return err; 809 return err;
804 case NL80211_IFTYPE_MESH_POINT: 810 case NL80211_IFTYPE_MESH_POINT:
@@ -807,9 +813,11 @@ static int cfg80211_wext_siwfreq(struct net_device *dev,
807 return freq; 813 return freq;
808 if (freq == 0) 814 if (freq == 0)
809 return -EINVAL; 815 return -EINVAL;
816 chandef.chan = ieee80211_get_channel(&rdev->wiphy, freq);
817 if (!chandef.chan)
818 return -EINVAL;
810 mutex_lock(&rdev->devlist_mtx); 819 mutex_lock(&rdev->devlist_mtx);
811 err = cfg80211_set_mesh_freq(rdev, wdev, freq, 820 err = cfg80211_set_mesh_channel(rdev, wdev, &chandef);
812 NL80211_CHAN_NO_HT);
813 mutex_unlock(&rdev->devlist_mtx); 821 mutex_unlock(&rdev->devlist_mtx);
814 return err; 822 return err;
815 default: 823 default:
@@ -823,8 +831,8 @@ static int cfg80211_wext_giwfreq(struct net_device *dev,
823{ 831{
824 struct wireless_dev *wdev = dev->ieee80211_ptr; 832 struct wireless_dev *wdev = dev->ieee80211_ptr;
825 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); 833 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
826 struct ieee80211_channel *chan; 834 struct cfg80211_chan_def chandef;
827 enum nl80211_channel_type channel_type; 835 int ret;
828 836
829 switch (wdev->iftype) { 837 switch (wdev->iftype) {
830 case NL80211_IFTYPE_STATION: 838 case NL80211_IFTYPE_STATION:
@@ -835,10 +843,10 @@ static int cfg80211_wext_giwfreq(struct net_device *dev,
835 if (!rdev->ops->get_channel) 843 if (!rdev->ops->get_channel)
836 return -EINVAL; 844 return -EINVAL;
837 845
838 chan = rdev_get_channel(rdev, wdev, &channel_type); 846 ret = rdev_get_channel(rdev, wdev, &chandef);
839 if (!chan) 847 if (ret)
840 return -EINVAL; 848 return ret;
841 freq->m = chan->center_freq; 849 freq->m = chandef.chan->center_freq;
842 freq->e = 6; 850 freq->e = 6;
843 return 0; 851 return 0;
844 default: 852 default: