summaryrefslogtreecommitdiff
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-12-04 00:14:17 +0100
committerJohannes Berg <johannes.berg@intel.com>2013-01-03 13:01:26 +0100
commit5d885b999c68283c493cf00cc020260d38951ae6 (patch)
tree0e835b5e2318bcbf2d2494d45662fa08c1b643df /net/wireless/reg.c
parent0ba857ad671aa8aa2a1276aa7a0c79abd0575146 (diff)
downloadlwn-5d885b999c68283c493cf00cc020260d38951ae6.tar.gz
lwn-5d885b999c68283c493cf00cc020260d38951ae6.zip
regulatory: simplify freq_reg_info_regd
The function itself has dual-purpose: it can retrieve from a given regdomain or from the globally installed one. Change it to have a single purpose only: to look up from a given regdomain. Pass the correct regdomain in the freq_reg_info() function instead. This also changes the locking rules for it, no locking is required any more. Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index b63bdf899a75..75239789213a 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -678,28 +678,15 @@ static int freq_reg_info_regd(struct wiphy *wiphy,
u32 center_freq,
u32 desired_bw_khz,
const struct ieee80211_reg_rule **reg_rule,
- const struct ieee80211_regdomain *custom_regd)
+ const struct ieee80211_regdomain *regd)
{
int i;
bool band_rule_found = false;
- const struct ieee80211_regdomain *regd;
bool bw_fits = false;
if (!desired_bw_khz)
desired_bw_khz = MHZ_TO_KHZ(20);
- regd = custom_regd ? custom_regd : cfg80211_regdomain;
-
- /*
- * Follow the driver's regulatory domain, if present, unless a country
- * IE has been processed or a user wants to help complaince further
- */
- if (!custom_regd &&
- last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
- last_request->initiator != NL80211_REGDOM_SET_BY_USER &&
- wiphy->regd)
- regd = wiphy->regd;
-
if (!regd)
return -EINVAL;
@@ -735,10 +722,24 @@ static int freq_reg_info_regd(struct wiphy *wiphy,
int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 desired_bw_khz,
const struct ieee80211_reg_rule **reg_rule)
{
+ const struct ieee80211_regdomain *regd;
+
+ assert_reg_lock();
assert_cfg80211_lock();
+ /*
+ * Follow the driver's regulatory domain, if present, unless a country
+ * IE has been processed or a user wants to help complaince further
+ */
+ if (last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
+ last_request->initiator != NL80211_REGDOM_SET_BY_USER &&
+ wiphy->regd)
+ regd = wiphy->regd;
+ else
+ regd = cfg80211_regdomain;
+
return freq_reg_info_regd(wiphy, center_freq, desired_bw_khz,
- reg_rule, NULL);
+ reg_rule, regd);
}
EXPORT_SYMBOL(freq_reg_info);