Commit 2c3e861c authored by Arik Nemtsov's avatar Arik Nemtsov Committed by Johannes Berg

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: default avatarArik Nemtsov <arikx.nemtsov@intel.com>
Reviewed-by: default avatarIlan Peer <ilan.peer@intel.com>
Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 2726f23d
...@@ -3788,6 +3788,20 @@ int regulatory_hint(struct wiphy *wiphy, const char *alpha2); ...@@ -3788,6 +3788,20 @@ int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
int regulatory_set_wiphy_regd(struct wiphy *wiphy, int regulatory_set_wiphy_regd(struct wiphy *wiphy,
struct ieee80211_regdomain *rd); struct ieee80211_regdomain *rd);
/**
* regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
* @wiphy: the wireless device we want to process the regulatory domain on
* @rd: the regulatory domain information to use for this wiphy
*
* This functions requires the RTNL to be held and applies the new regdomain
* synchronously to this wiphy. For more details see
* regulatory_set_wiphy_regd().
*
* Return: 0 on success. -EINVAL, -EPERM
*/
int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
struct ieee80211_regdomain *rd);
/** /**
* wiphy_apply_custom_regulatory - apply a custom driver regulatory domain * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
* @wiphy: the wireless device we want to process the regulatory domain on * @wiphy: the wireless device we want to process the regulatory domain on
......
...@@ -2897,7 +2897,7 @@ int set_regdom(const struct ieee80211_regdomain *rd) ...@@ -2897,7 +2897,7 @@ int set_regdom(const struct ieee80211_regdomain *rd)
return 0; return 0;
} }
int regulatory_set_wiphy_regd(struct wiphy *wiphy, static int __regulatory_set_wiphy_regd(struct wiphy *wiphy,
struct ieee80211_regdomain *rd) struct ieee80211_regdomain *rd)
{ {
const struct ieee80211_regdomain *regd; const struct ieee80211_regdomain *regd;
...@@ -2928,12 +2928,39 @@ int regulatory_set_wiphy_regd(struct wiphy *wiphy, ...@@ -2928,12 +2928,39 @@ int regulatory_set_wiphy_regd(struct wiphy *wiphy,
spin_unlock(&reg_requests_lock); spin_unlock(&reg_requests_lock);
kfree(prev_regd); kfree(prev_regd);
return 0;
}
int regulatory_set_wiphy_regd(struct wiphy *wiphy,
struct ieee80211_regdomain *rd)
{
int ret = __regulatory_set_wiphy_regd(wiphy, rd);
if (ret)
return ret;
schedule_work(&reg_work); schedule_work(&reg_work);
return 0; return 0;
} }
EXPORT_SYMBOL(regulatory_set_wiphy_regd); EXPORT_SYMBOL(regulatory_set_wiphy_regd);
int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
struct ieee80211_regdomain *rd)
{
int ret;
ASSERT_RTNL();
ret = __regulatory_set_wiphy_regd(wiphy, rd);
if (ret)
return ret;
/* process the request immediately */
reg_process_self_managed_hints();
return 0;
}
EXPORT_SYMBOL(regulatory_set_wiphy_regd_sync_rtnl);
void wiphy_regulatory_register(struct wiphy *wiphy) void wiphy_regulatory_register(struct wiphy *wiphy)
{ {
struct regulatory_request *lr; struct regulatory_request *lr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment