aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2013-11-11 16:15:29 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-11-25 14:51:46 -0500
commita2f73b6c5db3c272d87eaebb5bed355d75a0f25f (patch)
tree1cf299d0c5b2287afe742430d7e15cb3c1d43b4f /net/wireless/reg.c
parentca91dc97b8a0ffd05721806654eaff2cf13ba5cb (diff)
cfg80211: move regulatory flags to their own variable
We'll expand this later, this will make it easier to classify and review what things are related to regulatory or not. Coccinelle only missed 4 hits, which I had to do manually, supplying the SmPL in case of merge conflicts. @@ struct wiphy *wiphy; @@ -wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY +wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG @@ expression e; @@ -e->flags |= WIPHY_FLAG_CUSTOM_REGULATORY +e->regulatory_flags |= REGULATORY_CUSTOM_REG @@ struct wiphy *wiphy; @@ -wiphy->flags &= ~WIPHY_FLAG_CUSTOM_REGULATORY +wiphy->regulatory_flags &= ~REGULATORY_CUSTOM_REG @@ struct wiphy *wiphy; @@ -wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY +wiphy->regulatory_flags & REGULATORY_CUSTOM_REG @@ struct wiphy *wiphy; @@ -wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY +wiphy->regulatory_flags |= REGULATORY_STRICT_REG @@ expression e; @@ -e->flags |= WIPHY_FLAG_STRICT_REGULATORY +e->regulatory_flags |= REGULATORY_STRICT_REG @@ struct wiphy *wiphy; @@ -wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY +wiphy->regulatory_flags &= ~REGULATORY_STRICT_REG @@ struct wiphy *wiphy; @@ -wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY +wiphy->regulatory_flags & REGULATORY_STRICT_REG @@ struct wiphy *wiphy; @@ -wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS +wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS @@ expression e; @@ -e->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS +e->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS @@ struct wiphy *wiphy; @@ -wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS +wiphy->regulatory_flags &= ~REGULATORY_DISABLE_BEACON_HINTS @@ struct wiphy *wiphy; @@ -wiphy->flags & WIPHY_FLAG_DISABLE_BEACON_HINTS +wiphy->regulatory_flags & REGULATORY_DISABLE_BEACON_HINTS Generated-by: Coccinelle SmPL Cc: Julia Lawall <julia.lawall@lip6.fr> Cc: Peter Senna Tschudin <peter.senna@gmail.com> Cc: Mihir Shete <smihir@qti.qualcomm.com> Cc: Henri Bahini <hbahini@qca.qualcomm.com> Cc: Tushnim Bhattacharyya <tushnimb@qca.qualcomm.com> Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com> [fix up whitespace damage, overly long lines] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index a75c5eddd25f..e44b4bb20b92 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -868,7 +868,7 @@ static void handle_channel(struct wiphy *wiphy,
868 868
869 if (lr->initiator == NL80211_REGDOM_SET_BY_DRIVER && 869 if (lr->initiator == NL80211_REGDOM_SET_BY_DRIVER &&
870 request_wiphy && request_wiphy == wiphy && 870 request_wiphy && request_wiphy == wiphy &&
871 request_wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) { 871 request_wiphy->regulatory_flags & REGULATORY_STRICT_REG) {
872 REG_DBG_PRINT("Disabling freq %d MHz for good\n", 872 REG_DBG_PRINT("Disabling freq %d MHz for good\n",
873 chan->center_freq); 873 chan->center_freq);
874 chan->orig_flags |= IEEE80211_CHAN_DISABLED; 874 chan->orig_flags |= IEEE80211_CHAN_DISABLED;
@@ -895,7 +895,7 @@ static void handle_channel(struct wiphy *wiphy,
895 895
896 if (lr->initiator == NL80211_REGDOM_SET_BY_DRIVER && 896 if (lr->initiator == NL80211_REGDOM_SET_BY_DRIVER &&
897 request_wiphy && request_wiphy == wiphy && 897 request_wiphy && request_wiphy == wiphy &&
898 request_wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) { 898 request_wiphy->regulatory_flags & REGULATORY_STRICT_REG) {
899 /* 899 /*
900 * This guarantees the driver's requested regulatory domain 900 * This guarantees the driver's requested regulatory domain
901 * will always be used as a base for further regulatory 901 * will always be used as a base for further regulatory
@@ -922,12 +922,12 @@ static void handle_channel(struct wiphy *wiphy,
922 if (chan->orig_mpwr) { 922 if (chan->orig_mpwr) {
923 /* 923 /*
924 * Devices that have their own custom regulatory domain 924 * Devices that have their own custom regulatory domain
925 * but also use WIPHY_FLAG_STRICT_REGULATORY will follow the 925 * but also use REGULATORY_STRICT_REG will follow the
926 * passed country IE power settings. 926 * passed country IE power settings.
927 */ 927 */
928 if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE && 928 if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE &&
929 wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY && 929 wiphy->regulatory_flags & REGULATORY_CUSTOM_REG &&
930 wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) 930 wiphy->regulatory_flags & REGULATORY_STRICT_REG)
931 chan->max_power = chan->max_reg_power; 931 chan->max_power = chan->max_reg_power;
932 else 932 else
933 chan->max_power = min(chan->orig_mpwr, 933 chan->max_power = min(chan->orig_mpwr,
@@ -997,8 +997,8 @@ static bool reg_dev_ignore_cell_hint(struct wiphy *wiphy)
997 997
998static bool wiphy_strict_alpha2_regd(struct wiphy *wiphy) 998static bool wiphy_strict_alpha2_regd(struct wiphy *wiphy)
999{ 999{
1000 if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY && 1000 if (wiphy->regulatory_flags & REGULATORY_STRICT_REG &&
1001 !(wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY)) 1001 !(wiphy->regulatory_flags & REGULATORY_CUSTOM_REG))
1002 return true; 1002 return true;
1003 return false; 1003 return false;
1004} 1004}
@@ -1016,7 +1016,7 @@ static bool ignore_reg_update(struct wiphy *wiphy,
1016 } 1016 }
1017 1017
1018 if (initiator == NL80211_REGDOM_SET_BY_CORE && 1018 if (initiator == NL80211_REGDOM_SET_BY_CORE &&
1019 wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) { 1019 wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) {
1020 REG_DBG_PRINT("Ignoring regulatory request set by %s " 1020 REG_DBG_PRINT("Ignoring regulatory request set by %s "
1021 "since the driver uses its own custom " 1021 "since the driver uses its own custom "
1022 "regulatory domain\n", 1022 "regulatory domain\n",
@@ -1054,7 +1054,7 @@ static bool reg_is_world_roaming(struct wiphy *wiphy)
1054 return true; 1054 return true;
1055 1055
1056 if (lr && lr->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && 1056 if (lr && lr->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
1057 wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) 1057 wiphy->regulatory_flags & REGULATORY_CUSTOM_REG)
1058 return true; 1058 return true;
1059 1059
1060 return false; 1060 return false;
@@ -1082,7 +1082,7 @@ static void handle_reg_beacon(struct wiphy *wiphy, unsigned int chan_idx,
1082 if (!reg_is_world_roaming(wiphy)) 1082 if (!reg_is_world_roaming(wiphy))
1083 return; 1083 return;
1084 1084
1085 if (wiphy->flags & WIPHY_FLAG_DISABLE_BEACON_HINTS) 1085 if (wiphy->regulatory_flags & REGULATORY_DISABLE_BEACON_HINTS)
1086 return; 1086 return;
1087 1087
1088 chan_before.center_freq = chan->center_freq; 1088 chan_before.center_freq = chan->center_freq;
@@ -1242,7 +1242,7 @@ static void wiphy_update_regulatory(struct wiphy *wiphy,
1242 * as some drivers used this to restore its orig_* reg domain. 1242 * as some drivers used this to restore its orig_* reg domain.
1243 */ 1243 */
1244 if (initiator == NL80211_REGDOM_SET_BY_CORE && 1244 if (initiator == NL80211_REGDOM_SET_BY_CORE &&
1245 wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) 1245 wiphy->regulatory_flags & REGULATORY_CUSTOM_REG)
1246 reg_call_notifier(wiphy, lr); 1246 reg_call_notifier(wiphy, lr);
1247 return; 1247 return;
1248 } 1248 }
@@ -1328,9 +1328,9 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
1328 enum ieee80211_band band; 1328 enum ieee80211_band band;
1329 unsigned int bands_set = 0; 1329 unsigned int bands_set = 0;
1330 1330
1331 WARN(!(wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY), 1331 WARN(!(wiphy->regulatory_flags & REGULATORY_CUSTOM_REG),
1332 "wiphy should have WIPHY_FLAG_CUSTOM_REGULATORY\n"); 1332 "wiphy should have REGULATORY_CUSTOM_REG\n");
1333 wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; 1333 wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
1334 1334
1335 for (band = 0; band < IEEE80211_NUM_BANDS; band++) { 1335 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
1336 if (!wiphy->bands[band]) 1336 if (!wiphy->bands[band])
@@ -1659,7 +1659,7 @@ static void reg_process_hint(struct regulatory_request *reg_request)
1659 1659
1660 /* This is required so that the orig_* parameters are saved */ 1660 /* This is required so that the orig_* parameters are saved */
1661 if (treatment == REG_REQ_ALREADY_SET && wiphy && 1661 if (treatment == REG_REQ_ALREADY_SET && wiphy &&
1662 wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) 1662 wiphy->regulatory_flags & REGULATORY_STRICT_REG)
1663 wiphy_update_regulatory(wiphy, reg_request->initiator); 1663 wiphy_update_regulatory(wiphy, reg_request->initiator);
1664} 1664}
1665 1665
@@ -1986,7 +1986,7 @@ static void restore_regulatory_settings(bool reset_user)
1986 world_alpha2[1] = cfg80211_world_regdom->alpha2[1]; 1986 world_alpha2[1] = cfg80211_world_regdom->alpha2[1];
1987 1987
1988 list_for_each_entry(rdev, &cfg80211_rdev_list, list) { 1988 list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
1989 if (rdev->wiphy.flags & WIPHY_FLAG_CUSTOM_REGULATORY) 1989 if (rdev->wiphy.regulatory_flags & REGULATORY_CUSTOM_REG)
1990 restore_custom_reg_settings(&rdev->wiphy); 1990 restore_custom_reg_settings(&rdev->wiphy);
1991 } 1991 }
1992 1992