aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2015-01-07 09:47:19 -0500
committerJohannes Berg <johannes.berg@intel.com>2015-01-14 03:43:44 -0500
commit2c3e861c94a29a30c75f60f2561b4ee70b3fb3a4 (patch)
tree83edc4013e502b66a541779c486a5bf53c51b5f5 /net/wireless
parent2726f23d2d3775668f00b9a884eb88cd8812917c (diff)
cfg80211: introduce sync regdom set API for self-managed
A self-managed device will sometimes need to set its regdomain synchronously. Notably it should be set before usermode has a chance to query it. Expose a new API to accomplish this which requires the RTNL. Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com> Reviewed-by: Ilan Peer <ilan.peer@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/reg.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 8d232b904210..f8ed79729eb0 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2897,8 +2897,8 @@ int set_regdom(const struct ieee80211_regdomain *rd)
2897 return 0; 2897 return 0;
2898} 2898}
2899 2899
2900int regulatory_set_wiphy_regd(struct wiphy *wiphy, 2900static int __regulatory_set_wiphy_regd(struct wiphy *wiphy,
2901 struct ieee80211_regdomain *rd) 2901 struct ieee80211_regdomain *rd)
2902{ 2902{
2903 const struct ieee80211_regdomain *regd; 2903 const struct ieee80211_regdomain *regd;
2904 const struct ieee80211_regdomain *prev_regd; 2904 const struct ieee80211_regdomain *prev_regd;
@@ -2928,12 +2928,39 @@ int regulatory_set_wiphy_regd(struct wiphy *wiphy,
2928 spin_unlock(&reg_requests_lock); 2928 spin_unlock(&reg_requests_lock);
2929 2929
2930 kfree(prev_regd); 2930 kfree(prev_regd);
2931 return 0;
2932}
2933
2934int regulatory_set_wiphy_regd(struct wiphy *wiphy,
2935 struct ieee80211_regdomain *rd)
2936{
2937 int ret = __regulatory_set_wiphy_regd(wiphy, rd);
2938
2939 if (ret)
2940 return ret;
2931 2941
2932 schedule_work(&reg_work); 2942 schedule_work(&reg_work);
2933 return 0; 2943 return 0;
2934} 2944}
2935EXPORT_SYMBOL(regulatory_set_wiphy_regd); 2945EXPORT_SYMBOL(regulatory_set_wiphy_regd);
2936 2946
2947int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
2948 struct ieee80211_regdomain *rd)
2949{
2950 int ret;
2951
2952 ASSERT_RTNL();
2953
2954 ret = __regulatory_set_wiphy_regd(wiphy, rd);
2955 if (ret)
2956 return ret;
2957
2958 /* process the request immediately */
2959 reg_process_self_managed_hints();
2960 return 0;
2961}
2962EXPORT_SYMBOL(regulatory_set_wiphy_regd_sync_rtnl);
2963
2937void wiphy_regulatory_register(struct wiphy *wiphy) 2964void wiphy_regulatory_register(struct wiphy *wiphy)
2938{ 2965{
2939 struct regulatory_request *lr; 2966 struct regulatory_request *lr;