aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2008-11-12 17:21:58 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-11-25 16:41:23 -0500
commitb8295acdc323e6e383ec822fc1e95edeb9148513 (patch)
tree546df8e8b2c478522ad222ccfa6bb16e8903d7a2 /net/wireless/reg.c
parent8375af3ba213154041cfbc655f452913f23bfbd5 (diff)
cfg80211: separate intersection section in __set_regdom()
So far the __set_regdom() code is pretty generic as the intersection case is fairly straight forward; this will however change when 802.11d support is added so lets separate intersection code for now in preparation for 802.11d support. This patch only has slight functional changes. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 290ececd4f11..845e2d326632 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -826,10 +826,6 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
826 if (WARN_ON(!reg_is_valid_request(rd->alpha2))) 826 if (WARN_ON(!reg_is_valid_request(rd->alpha2)))
827 return -EINVAL; 827 return -EINVAL;
828 828
829 reset_regdomains();
830
831 /* Country IE parsing coming soon */
832
833 if (!is_valid_rd(rd)) { 829 if (!is_valid_rd(rd)) {
834 printk(KERN_ERR "cfg80211: Invalid " 830 printk(KERN_ERR "cfg80211: Invalid "
835 "regulatory domain detected:\n"); 831 "regulatory domain detected:\n");
@@ -837,16 +833,33 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
837 return -EINVAL; 833 return -EINVAL;
838 } 834 }
839 835
840 if (unlikely(last_request->intersect)) { 836 if (!last_request->intersect) {
837 reset_regdomains();
838 cfg80211_regdomain = rd;
839 return 0;
840 }
841
842 /* Intersection requires a bit more work */
843
844 if (last_request->initiator != REGDOM_SET_BY_COUNTRY_IE) {
845
841 intersected_rd = regdom_intersect(rd, cfg80211_regdomain); 846 intersected_rd = regdom_intersect(rd, cfg80211_regdomain);
842 if (!intersected_rd) 847 if (!intersected_rd)
843 return -EINVAL; 848 return -EINVAL;
849
850 /* We can trash what CRDA provided now */
844 kfree(rd); 851 kfree(rd);
845 rd = intersected_rd; 852 rd = NULL;
853
854 reset_regdomains();
855 cfg80211_regdomain = intersected_rd;
856
857 return 0;
846 } 858 }
847 859
848 /* Tada! */ 860 /* Country IE parsing coming soon */
849 cfg80211_regdomain = rd; 861 reset_regdomains();
862 WARN_ON(1);
850 863
851 return 0; 864 return 0;
852} 865}