diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-02-21 00:04:23 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-27 14:52:55 -0500 |
commit | ba25c1414264f1f5fc046cf34d20947e41713a0d (patch) | |
tree | 16201731da736423d04ce67ce8ebb6e8c9794ac6 /net | |
parent | 80778f18c09673df2712c7da28aa920469adcae2 (diff) |
cfg80211: add regulatory_hint_core() to separate the core reg hint
This makes the core hint path more readable and allows for us to
later make it obvious under what circumstances we need locking or not.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/wireless/reg.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index ba823120d245..6373a78a37e7 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -1050,11 +1050,7 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by, | |||
1050 | case REGDOM_SET_BY_INIT: | 1050 | case REGDOM_SET_BY_INIT: |
1051 | return -EINVAL; | 1051 | return -EINVAL; |
1052 | case REGDOM_SET_BY_CORE: | 1052 | case REGDOM_SET_BY_CORE: |
1053 | /* | 1053 | return -EINVAL; |
1054 | * Always respect new wireless core hints, should only happen | ||
1055 | * when updating the world regulatory domain at init. | ||
1056 | */ | ||
1057 | return 0; | ||
1058 | case REGDOM_SET_BY_COUNTRY_IE: | 1054 | case REGDOM_SET_BY_COUNTRY_IE: |
1059 | if (unlikely(!is_an_alpha2(alpha2))) | 1055 | if (unlikely(!is_an_alpha2(alpha2))) |
1060 | return -EINVAL; | 1056 | return -EINVAL; |
@@ -1183,6 +1179,26 @@ new_request: | |||
1183 | return call_crda(alpha2); | 1179 | return call_crda(alpha2); |
1184 | } | 1180 | } |
1185 | 1181 | ||
1182 | static int regulatory_hint_core(const char *alpha2) | ||
1183 | { | ||
1184 | struct regulatory_request *request; | ||
1185 | |||
1186 | BUG_ON(last_request); | ||
1187 | |||
1188 | request = kzalloc(sizeof(struct regulatory_request), | ||
1189 | GFP_KERNEL); | ||
1190 | if (!request) | ||
1191 | return -ENOMEM; | ||
1192 | |||
1193 | request->alpha2[0] = alpha2[0]; | ||
1194 | request->alpha2[1] = alpha2[1]; | ||
1195 | request->initiator = REGDOM_SET_BY_CORE; | ||
1196 | |||
1197 | last_request = request; | ||
1198 | |||
1199 | return call_crda(alpha2); | ||
1200 | } | ||
1201 | |||
1186 | void regulatory_hint(struct wiphy *wiphy, const char *alpha2) | 1202 | void regulatory_hint(struct wiphy *wiphy, const char *alpha2) |
1187 | { | 1203 | { |
1188 | int r; | 1204 | int r; |
@@ -1616,16 +1632,16 @@ int regulatory_init(void) | |||
1616 | * stuck with the static values. We ignore "EU" code as | 1632 | * stuck with the static values. We ignore "EU" code as |
1617 | * that is not a valid ISO / IEC 3166 alpha2 */ | 1633 | * that is not a valid ISO / IEC 3166 alpha2 */ |
1618 | if (ieee80211_regdom[0] != 'E' || ieee80211_regdom[1] != 'U') | 1634 | if (ieee80211_regdom[0] != 'E' || ieee80211_regdom[1] != 'U') |
1619 | err = __regulatory_hint(NULL, REGDOM_SET_BY_CORE, | 1635 | err = regulatory_hint_core(ieee80211_regdom); |
1620 | ieee80211_regdom, 0, ENVIRON_ANY); | ||
1621 | #else | 1636 | #else |
1622 | cfg80211_regdomain = cfg80211_world_regdom; | 1637 | cfg80211_regdomain = cfg80211_world_regdom; |
1623 | 1638 | ||
1624 | err = __regulatory_hint(NULL, REGDOM_SET_BY_CORE, "00", 0, ENVIRON_ANY); | 1639 | err = regulatory_hint_core("00"); |
1625 | if (err) | 1640 | if (err) { |
1626 | printk(KERN_ERR "cfg80211: calling CRDA failed - " | 1641 | printk(KERN_ERR "cfg80211: calling CRDA failed - " |
1627 | "unable to update world regulatory domain, " | 1642 | "unable to update world regulatory domain, " |
1628 | "using static definition\n"); | 1643 | "using static definition\n"); |
1644 | } | ||
1629 | #endif | 1645 | #endif |
1630 | 1646 | ||
1631 | return 0; | 1647 | return 0; |