This adds regdom_intersect_wiphy_regd() which can be used by drivers on their reg_notifier() to further restrict the device's regulatory domain. This is important for devices where calibration outside of the device's supported regulatory domain is not supported or certified through proper testing for operation. Signed-off-by: Luis R. Rodriguez <lrodriguez@xxxxxxxxxxx> --- include/net/wireless.h | 14 ++++++++++++++ net/wireless/reg.c | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/include/net/wireless.h b/include/net/wireless.h index 16f020a..cb04e7b 100644 --- a/include/net/wireless.h +++ b/include/net/wireless.h @@ -423,4 +423,18 @@ extern int regulatory_set_custom_rd( struct wiphy *wiphy, const struct ieee80211_regdomain *custom_regd); +/** + * regdom_intersect_wiphy_regd - do intersection on driver's regulatory domain + * @wiphy: the wireless device we want to process the intersected regulatory + * domain on + * + * This function can be used on a driver's reg_notifier() when cfg80211's + * regulatory domain has been updated and a driver must follow nothing + * more than what was on its own driver regulatory domain. The driver must + * have previously called regulatory_hint() or regulatory_set_custom_rd(). + * Note that the reg_notifier() is called with the cfg80211_drv_mutex already + * held. + */ +extern int regdom_intersect_wiphy_regd(struct wiphy *wiphy); + #endif /* __NET_WIRELESS_H */ diff --git a/net/wireless/reg.c b/net/wireless/reg.c index b05df36..88e8ff0 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -979,6 +979,21 @@ void wiphy_update_regulatory(struct wiphy *wiphy, enum reg_set_by setby) wiphy->reg_notifier(wiphy, setby); } +/* Does not call the reg_notifier() */ +int regdom_intersect_wiphy_regd(struct wiphy *wiphy) +{ + const struct ieee80211_regdomain *regd; + BUG_ON(!wiphy->regd); + regd = regdom_intersect(wiphy->regd, cfg80211_regdomain); + if (!regd) + return -EINVAL; + kfree(wiphy->regd); + wiphy->regd = regd; + regd_update_regulatory(wiphy); + return 0; +} +EXPORT_SYMBOL(regdom_intersect_wiphy_regd); + static int reg_copy_regd(const struct ieee80211_regdomain **dst_regd, const struct ieee80211_regdomain *src_regd) { -- 1.6.1.rc3.51.g5832d -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html