Commit b8295acd authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville

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: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 8375af3b
...@@ -826,10 +826,6 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) ...@@ -826,10 +826,6 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
if (WARN_ON(!reg_is_valid_request(rd->alpha2))) if (WARN_ON(!reg_is_valid_request(rd->alpha2)))
return -EINVAL; return -EINVAL;
reset_regdomains();
/* Country IE parsing coming soon */
if (!is_valid_rd(rd)) { if (!is_valid_rd(rd)) {
printk(KERN_ERR "cfg80211: Invalid " printk(KERN_ERR "cfg80211: Invalid "
"regulatory domain detected:\n"); "regulatory domain detected:\n");
...@@ -837,16 +833,33 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) ...@@ -837,16 +833,33 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
return -EINVAL; return -EINVAL;
} }
if (unlikely(last_request->intersect)) { if (!last_request->intersect) {
reset_regdomains();
cfg80211_regdomain = rd;
return 0;
}
/* Intersection requires a bit more work */
if (last_request->initiator != REGDOM_SET_BY_COUNTRY_IE) {
intersected_rd = regdom_intersect(rd, cfg80211_regdomain); intersected_rd = regdom_intersect(rd, cfg80211_regdomain);
if (!intersected_rd) if (!intersected_rd)
return -EINVAL; return -EINVAL;
/* We can trash what CRDA provided now */
kfree(rd); kfree(rd);
rd = intersected_rd; rd = NULL;
reset_regdomains();
cfg80211_regdomain = intersected_rd;
return 0;
} }
/* Tada! */ /* Country IE parsing coming soon */
cfg80211_regdomain = rd; reset_regdomains();
WARN_ON(1);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment