aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2013-11-05 12:18:03 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-11-25 14:51:05 -0500
commitb3eb7f3f592c0a5ae96c0cf53037f1a1d7eb4a85 (patch)
treeb04f0299e1ecb202545e10862f637d653d18b942
parente438768ff9b22c83a968e14b79e8c83128e8bfe4 (diff)
cfg80211: processing core regulatory hints on its own
This makes the code path easier to read for the core case. Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com> [add warning to default case in switch to avoid compile warning] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/wireless/reg.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index d8f047aadd49..2b7ab01b2616 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1337,7 +1337,7 @@ get_reg_request_treatment(struct wiphy *wiphy,
1337 1337
1338 switch (pending_request->initiator) { 1338 switch (pending_request->initiator) {
1339 case NL80211_REGDOM_SET_BY_CORE: 1339 case NL80211_REGDOM_SET_BY_CORE:
1340 return REG_REQ_OK; 1340 return REG_REQ_IGNORE;
1341 case NL80211_REGDOM_SET_BY_COUNTRY_IE: 1341 case NL80211_REGDOM_SET_BY_COUNTRY_IE:
1342 if (reg_request_cell_base(lr)) { 1342 if (reg_request_cell_base(lr)) {
1343 /* Trust a Cell base station over the AP's country IE */ 1343 /* Trust a Cell base station over the AP's country IE */
@@ -1443,6 +1443,33 @@ static void reg_set_request_processed(void)
1443} 1443}
1444 1444
1445/** 1445/**
1446 * reg_process_hint_core - process core regulatory requests
1447 * @pending_request: a pending core regulatory request
1448 *
1449 * The wireless subsystem can use this function to process
1450 * a regulatory request issued by the regulatory core.
1451 *
1452 * Returns one of the different reg request treatment values.
1453 */
1454static enum reg_request_treatment
1455reg_process_hint_core(struct regulatory_request *core_request)
1456{
1457 struct regulatory_request *lr;
1458
1459 lr = get_last_request();
1460 if (lr != &core_request_world && lr)
1461 kfree_rcu(lr, rcu_head);
1462
1463 core_request->intersect = false;
1464 core_request->processed = false;
1465 rcu_assign_pointer(last_request, core_request);
1466
1467 if (call_crda(core_request->alpha2))
1468 return REG_REQ_IGNORE;
1469 return REG_REQ_OK;
1470}
1471
1472/**
1446 * __regulatory_hint - hint to the wireless core a regulatory domain 1473 * __regulatory_hint - hint to the wireless core a regulatory domain
1447 * @wiphy: if the hint comes from country information from an AP, this 1474 * @wiphy: if the hint comes from country information from an AP, this
1448 * is required to be set to the wiphy that received the information 1475 * is required to be set to the wiphy that received the information
@@ -1540,6 +1567,7 @@ new_request:
1540static void reg_process_hint(struct regulatory_request *reg_request) 1567static void reg_process_hint(struct regulatory_request *reg_request)
1541{ 1568{
1542 struct wiphy *wiphy = NULL; 1569 struct wiphy *wiphy = NULL;
1570 enum reg_request_treatment treatment;
1543 1571
1544 if (WARN_ON(!reg_request->alpha2)) 1572 if (WARN_ON(!reg_request->alpha2))
1545 return; 1573 return;
@@ -1552,7 +1580,21 @@ static void reg_process_hint(struct regulatory_request *reg_request)
1552 return; 1580 return;
1553 } 1581 }
1554 1582
1555 switch (__regulatory_hint(wiphy, reg_request)) { 1583 switch (reg_request->initiator) {
1584 case NL80211_REGDOM_SET_BY_CORE:
1585 reg_process_hint_core(reg_request);
1586 return;
1587 case NL80211_REGDOM_SET_BY_USER:
1588 case NL80211_REGDOM_SET_BY_DRIVER:
1589 case NL80211_REGDOM_SET_BY_COUNTRY_IE:
1590 treatment = __regulatory_hint(wiphy, reg_request);
1591 break;
1592 default:
1593 WARN(1, "invalid initiator %d\n", reg_request->initiator);
1594 return;
1595 }
1596
1597 switch (treatment) {
1556 case REG_REQ_ALREADY_SET: 1598 case REG_REQ_ALREADY_SET:
1557 /* This is required so that the orig_* parameters are saved */ 1599 /* This is required so that the orig_* parameters are saved */
1558 if (wiphy && wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) 1600 if (wiphy && wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY)