diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-12-03 18:14:17 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-01-03 07:01:26 -0500 |
commit | 5d885b999c68283c493cf00cc020260d38951ae6 (patch) | |
tree | 0e835b5e2318bcbf2d2494d45662fa08c1b643df /net/wireless/reg.c | |
parent | 0ba857ad671aa8aa2a1276aa7a0c79abd0575146 (diff) |
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.c | 31 |
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, | |||
678 | u32 center_freq, | 678 | u32 center_freq, |
679 | u32 desired_bw_khz, | 679 | u32 desired_bw_khz, |
680 | const struct ieee80211_reg_rule **reg_rule, | 680 | const struct ieee80211_reg_rule **reg_rule, |
681 | const struct ieee80211_regdomain *custom_regd) | 681 | const struct ieee80211_regdomain *regd) |
682 | { | 682 | { |
683 | int i; | 683 | int i; |
684 | bool band_rule_found = false; | 684 | bool band_rule_found = false; |
685 | const struct ieee80211_regdomain *regd; | ||
686 | bool bw_fits = false; | 685 | bool bw_fits = false; |
687 | 686 | ||
688 | if (!desired_bw_khz) | 687 | if (!desired_bw_khz) |
689 | desired_bw_khz = MHZ_TO_KHZ(20); | 688 | desired_bw_khz = MHZ_TO_KHZ(20); |
690 | 689 | ||
691 | regd = custom_regd ? custom_regd : cfg80211_regdomain; | ||
692 | |||
693 | /* | ||
694 | * Follow the driver's regulatory domain, if present, unless a country | ||
695 | * IE has been processed or a user wants to help complaince further | ||
696 | */ | ||
697 | if (!custom_regd && | ||
698 | last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && | ||
699 | last_request->initiator != NL80211_REGDOM_SET_BY_USER && | ||
700 | wiphy->regd) | ||
701 | regd = wiphy->regd; | ||
702 | |||
703 | if (!regd) | 690 | if (!regd) |
704 | return -EINVAL; | 691 | return -EINVAL; |
705 | 692 | ||
@@ -735,10 +722,24 @@ static int freq_reg_info_regd(struct wiphy *wiphy, | |||
735 | int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 desired_bw_khz, | 722 | int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 desired_bw_khz, |
736 | const struct ieee80211_reg_rule **reg_rule) | 723 | const struct ieee80211_reg_rule **reg_rule) |
737 | { | 724 | { |
725 | const struct ieee80211_regdomain *regd; | ||
726 | |||
727 | assert_reg_lock(); | ||
738 | assert_cfg80211_lock(); | 728 | assert_cfg80211_lock(); |
739 | 729 | ||
730 | /* | ||
731 | * Follow the driver's regulatory domain, if present, unless a country | ||
732 | * IE has been processed or a user wants to help complaince further | ||
733 | */ | ||
734 | if (last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && | ||
735 | last_request->initiator != NL80211_REGDOM_SET_BY_USER && | ||
736 | wiphy->regd) | ||
737 | regd = wiphy->regd; | ||
738 | else | ||
739 | regd = cfg80211_regdomain; | ||
740 | |||
740 | return freq_reg_info_regd(wiphy, center_freq, desired_bw_khz, | 741 | return freq_reg_info_regd(wiphy, center_freq, desired_bw_khz, |
741 | reg_rule, NULL); | 742 | reg_rule, regd); |
742 | } | 743 | } |
743 | EXPORT_SYMBOL(freq_reg_info); | 744 | EXPORT_SYMBOL(freq_reg_info); |
744 | 745 | ||