Skip to content

Commit a2f73b6

Browse files
mcgrofjmberg-intel
authored andcommitted
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>
1 parent ca91dc9 commit a2f73b6

14 files changed

Lines changed: 108 additions & 88 deletions

File tree

‎drivers/net/wireless/ath/regd.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,15 +601,15 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
601601
const struct ieee80211_regdomain *regd;
602602

603603
wiphy->reg_notifier = reg_notifier;
604-
wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY;
604+
wiphy->regulatory_flags |= REGULATORY_STRICT_REG;
605605

606606
if (ath_is_world_regd(reg)) {
607607
/*
608608
* Anything applied here (prior to wiphy registration) gets
609609
* saved on the wiphy orig_* parameters
610610
*/
611611
regd = ath_world_regdomain(reg);
612-
wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
612+
wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
613613
} else {
614614
/*
615615
* This gets applied in the case of the absence of CRDA,

‎drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4341,7 +4341,7 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev)
43414341
wiphy->max_remain_on_channel_duration = 5000;
43424342
brcmf_wiphy_pno_params(wiphy);
43434343
brcmf_dbg(INFO, "Registering custom regulatory\n");
4344-
wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
4344+
wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
43454345
wiphy_apply_custom_regulatory(wiphy, &brcmf_regdom);
43464346
err = wiphy_register(wiphy);
43474347
if (err < 0) {

‎drivers/net/wireless/brcm80211/brcmsmac/channel.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,8 @@ void brcms_c_regd_init(struct brcms_c_info *wlc)
766766
}
767767

768768
wlc->wiphy->reg_notifier = brcms_reg_notifier;
769-
wlc->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY |
770-
WIPHY_FLAG_STRICT_REGULATORY;
769+
wlc->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG |
770+
REGULATORY_STRICT_REG;
771771
wiphy_apply_custom_regulatory(wlc->wiphy, regd->regdomain);
772772
brcms_reg_apply_beaconing_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER);
773773
}

‎drivers/net/wireless/iwlegacy/3945-mac.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3575,9 +3575,9 @@ il3945_setup_mac(struct il_priv *il)
35753575
hw->wiphy->interface_modes =
35763576
BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC);
35773577

3578-
hw->wiphy->flags |=
3579-
WIPHY_FLAG_CUSTOM_REGULATORY | WIPHY_FLAG_DISABLE_BEACON_HINTS |
3580-
WIPHY_FLAG_IBSS_RSN;
3578+
hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
3579+
hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG |
3580+
REGULATORY_DISABLE_BEACON_HINTS;
35813581

35823582
hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
35833583

‎drivers/net/wireless/iwlegacy/4965-mac.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5778,9 +5778,9 @@ il4965_mac_setup_register(struct il_priv *il, u32 max_probe_length)
57785778
hw->wiphy->interface_modes =
57795779
BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC);
57805780

5781-
hw->wiphy->flags |=
5782-
WIPHY_FLAG_CUSTOM_REGULATORY | WIPHY_FLAG_DISABLE_BEACON_HINTS |
5783-
WIPHY_FLAG_IBSS_RSN;
5781+
hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
5782+
hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG |
5783+
REGULATORY_DISABLE_BEACON_HINTS;
57845784

57855785
/*
57865786
* For now, disable PS by default because it affects

‎drivers/net/wireless/iwlwifi/dvm/mac80211.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
155155
ARRAY_SIZE(iwlagn_iface_combinations_dualmode);
156156
}
157157

158-
hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY |
159-
WIPHY_FLAG_DISABLE_BEACON_HINTS |
160-
WIPHY_FLAG_IBSS_RSN;
158+
hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
159+
hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG |
160+
REGULATORY_DISABLE_BEACON_HINTS;
161161

162162
#ifdef CONFIG_PM_SLEEP
163163
if (priv->fw->img[IWL_UCODE_WOWLAN].sec[0].len &&

‎drivers/net/wireless/iwlwifi/mvm/mac80211.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
199199
if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 8)
200200
hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
201201

202-
hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY |
203-
WIPHY_FLAG_DISABLE_BEACON_HINTS |
204-
WIPHY_FLAG_IBSS_RSN;
202+
hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
203+
hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG |
204+
REGULATORY_DISABLE_BEACON_HINTS;
205205

206206
hw->wiphy->iface_combinations = iwl_mvm_iface_combinations;
207207
hw->wiphy->n_iface_combinations =

‎drivers/net/wireless/mac80211_hwsim.c‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2456,46 +2456,53 @@ static int __init init_mac80211_hwsim(void)
24562456
break;
24572457
case HWSIM_REGTEST_WORLD_ROAM:
24582458
if (i == 0) {
2459-
hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
2459+
hw->wiphy->regulatory_flags |=
2460+
REGULATORY_CUSTOM_REG;
24602461
wiphy_apply_custom_regulatory(hw->wiphy,
24612462
&hwsim_world_regdom_custom_01);
24622463
}
24632464
break;
24642465
case HWSIM_REGTEST_CUSTOM_WORLD:
2465-
hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
2466+
hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
24662467
wiphy_apply_custom_regulatory(hw->wiphy,
24672468
&hwsim_world_regdom_custom_01);
24682469
break;
24692470
case HWSIM_REGTEST_CUSTOM_WORLD_2:
24702471
if (i == 0) {
2471-
hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
2472+
hw->wiphy->regulatory_flags |=
2473+
REGULATORY_CUSTOM_REG;
24722474
wiphy_apply_custom_regulatory(hw->wiphy,
24732475
&hwsim_world_regdom_custom_01);
24742476
} else if (i == 1) {
2475-
hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
2477+
hw->wiphy->regulatory_flags |=
2478+
REGULATORY_CUSTOM_REG;
24762479
wiphy_apply_custom_regulatory(hw->wiphy,
24772480
&hwsim_world_regdom_custom_02);
24782481
}
24792482
break;
24802483
case HWSIM_REGTEST_STRICT_ALL:
2481-
hw->wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY;
2484+
hw->wiphy->regulatory_flags |= REGULATORY_STRICT_REG;
24822485
break;
24832486
case HWSIM_REGTEST_STRICT_FOLLOW:
24842487
case HWSIM_REGTEST_STRICT_AND_DRIVER_REG:
24852488
if (i == 0)
2486-
hw->wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY;
2489+
hw->wiphy->regulatory_flags |=
2490+
REGULATORY_STRICT_REG;
24872491
break;
24882492
case HWSIM_REGTEST_ALL:
24892493
if (i == 0) {
2490-
hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
2494+
hw->wiphy->regulatory_flags |=
2495+
REGULATORY_CUSTOM_REG;
24912496
wiphy_apply_custom_regulatory(hw->wiphy,
24922497
&hwsim_world_regdom_custom_01);
24932498
} else if (i == 1) {
2494-
hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
2499+
hw->wiphy->regulatory_flags |=
2500+
REGULATORY_CUSTOM_REG;
24952501
wiphy_apply_custom_regulatory(hw->wiphy,
24962502
&hwsim_world_regdom_custom_02);
24972503
} else if (i == 4)
2498-
hw->wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY;
2504+
hw->wiphy->regulatory_flags |=
2505+
REGULATORY_STRICT_REG;
24992506
break;
25002507
default:
25012508
break;

‎drivers/net/wireless/mwifiex/cfg80211.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2687,9 +2687,10 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
26872687
wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
26882688
WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
26892689
WIPHY_FLAG_AP_UAPSD |
2690-
WIPHY_FLAG_CUSTOM_REGULATORY |
2691-
WIPHY_FLAG_STRICT_REGULATORY |
26922690
WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
2691+
wiphy->regulatory_flags |=
2692+
REGULATORY_CUSTOM_REG |
2693+
REGULATORY_STRICT_REG;
26932694

26942695
wiphy_apply_custom_regulatory(wiphy, &mwifiex_world_regdom_custom);
26952696

‎drivers/net/wireless/rtlwifi/regd.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,9 @@ static int _rtl_regd_init_wiphy(struct rtl_regulatory *reg,
344344

345345
wiphy->reg_notifier = reg_notifier;
346346

347-
wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
348-
wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY;
349-
wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS;
347+
wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
348+
wiphy->regulatory_flags &= ~REGULATORY_STRICT_REG;
349+
wiphy->regulatory_flags &= ~REGULATORY_DISABLE_BEACON_HINTS;
350350

351351
regd = _rtl_regdomain_select(reg);
352352
wiphy_apply_custom_regulatory(wiphy, regd);

0 commit comments

Comments
 (0)