diff options
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r-- | net/wireless/reg.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index cad4daadba0d..89e0d8b3cf1e 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -867,6 +867,22 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band, | |||
867 | 867 | ||
868 | power_rule = ®_rule->power_rule; | 868 | power_rule = ®_rule->power_rule; |
869 | 869 | ||
870 | if (last_request->initiator == REGDOM_SET_BY_DRIVER && | ||
871 | last_request->wiphy && last_request->wiphy == wiphy && | ||
872 | last_request->wiphy->strict_regulatory) { | ||
873 | /* This gaurantees the driver's requested regulatory domain | ||
874 | * will always be used as a base for further regulatory | ||
875 | * settings */ | ||
876 | chan->flags = chan->orig_flags = | ||
877 | map_regdom_flags(reg_rule->flags); | ||
878 | chan->max_antenna_gain = chan->orig_mag = | ||
879 | (int) MBI_TO_DBI(power_rule->max_antenna_gain); | ||
880 | chan->max_bandwidth = KHZ_TO_MHZ(max_bandwidth); | ||
881 | chan->max_power = chan->orig_mpwr = | ||
882 | (int) MBM_TO_DBM(power_rule->max_eirp); | ||
883 | return; | ||
884 | } | ||
885 | |||
870 | chan->flags = flags | map_regdom_flags(reg_rule->flags); | 886 | chan->flags = flags | map_regdom_flags(reg_rule->flags); |
871 | chan->max_antenna_gain = min(chan->orig_mag, | 887 | chan->max_antenna_gain = min(chan->orig_mag, |
872 | (int) MBI_TO_DBI(power_rule->max_antenna_gain)); | 888 | (int) MBI_TO_DBI(power_rule->max_antenna_gain)); |
@@ -897,6 +913,11 @@ static bool ignore_reg_update(struct wiphy *wiphy, enum reg_set_by setby) | |||
897 | if (setby == REGDOM_SET_BY_CORE && | 913 | if (setby == REGDOM_SET_BY_CORE && |
898 | wiphy->custom_regulatory) | 914 | wiphy->custom_regulatory) |
899 | return true; | 915 | return true; |
916 | /* wiphy->regd will be set once the device has its own | ||
917 | * desired regulatory domain set */ | ||
918 | if (wiphy->strict_regulatory && !wiphy->regd && | ||
919 | !is_world_regdom(last_request->alpha2)) | ||
920 | return true; | ||
900 | return false; | 921 | return false; |
901 | } | 922 | } |
902 | 923 | ||
@@ -1155,10 +1176,15 @@ new_request: | |||
1155 | 1176 | ||
1156 | void regulatory_hint(struct wiphy *wiphy, const char *alpha2) | 1177 | void regulatory_hint(struct wiphy *wiphy, const char *alpha2) |
1157 | { | 1178 | { |
1179 | int r; | ||
1158 | BUG_ON(!alpha2); | 1180 | BUG_ON(!alpha2); |
1159 | 1181 | ||
1160 | mutex_lock(&cfg80211_drv_mutex); | 1182 | mutex_lock(&cfg80211_drv_mutex); |
1161 | __regulatory_hint(wiphy, REGDOM_SET_BY_DRIVER, alpha2, 0, ENVIRON_ANY); | 1183 | r = __regulatory_hint(wiphy, REGDOM_SET_BY_DRIVER, |
1184 | alpha2, 0, ENVIRON_ANY); | ||
1185 | /* This is required so that the orig_* parameters are saved */ | ||
1186 | if (r == -EALREADY && wiphy->strict_regulatory) | ||
1187 | wiphy_update_regulatory(wiphy, REGDOM_SET_BY_DRIVER); | ||
1162 | mutex_unlock(&cfg80211_drv_mutex); | 1188 | mutex_unlock(&cfg80211_drv_mutex); |
1163 | } | 1189 | } |
1164 | EXPORT_SYMBOL(regulatory_hint); | 1190 | EXPORT_SYMBOL(regulatory_hint); |