From: Johannes Berg Move the variable inside the CONFIG_CFG80211_REG_CELLULAR_HINTS block where it's actually used, and add a small helper to change it to avoid a warning from clang that it's set but not used. Signed-off-by: Johannes Berg --- net/wireless/reg.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 50f50e768f01..87eb581aee34 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -104,13 +104,6 @@ static struct faux_device *reg_fdev; */ const struct ieee80211_regdomain __rcu *cfg80211_regdomain; -/* - * Number of devices that registered to the core - * that support cellular base station regulatory hints - * (protected by cfg80211_mutex) - */ -static int reg_num_devs_support_basehint; - /* * State variable indicating if the platform on which the devices * are attached is operating in an indoor environment. The state variable @@ -2053,6 +2046,13 @@ bool reg_last_request_cell_base(void) } #ifdef CONFIG_CFG80211_REG_CELLULAR_HINTS +/* + * Number of devices that registered to the core + * that support cellular base station regulatory hints + * (protected by cfg80211_mutex) + */ +static int reg_num_devs_support_basehint; + /* Core specific check */ static enum reg_request_treatment reg_ignore_cell_hint(struct regulatory_request *pending_request) @@ -2074,6 +2074,12 @@ static bool reg_dev_ignore_cell_hint(struct wiphy *wiphy) { return !(wiphy->features & NL80211_FEATURE_CELL_BASE_REG_HINTS); } + +static void reg_update_cell_hint_num(struct wiphy *wiphy, int delta) +{ + if (!reg_dev_ignore_cell_hint(wiphy)) + reg_num_devs_support_basehint += delta; +} #else static enum reg_request_treatment reg_ignore_cell_hint(struct regulatory_request *pending_request) @@ -2085,6 +2091,10 @@ static bool reg_dev_ignore_cell_hint(struct wiphy *wiphy) { return true; } + +static void reg_update_cell_hint_num(struct wiphy *wiphy, int delta) +{ +} #endif static bool wiphy_strict_alpha2_regd(struct wiphy *wiphy) @@ -4179,7 +4189,7 @@ void wiphy_regulatory_register(struct wiphy *wiphy) } if (!reg_dev_ignore_cell_hint(wiphy)) - reg_num_devs_support_basehint++; + reg_update_cell_hint_num(wiphy, 1); wiphy_update_regulatory(wiphy, lr->initiator); wiphy_all_share_dfs_chan_state(wiphy); @@ -4197,8 +4207,7 @@ void wiphy_regulatory_deregister(struct wiphy *wiphy) lr = get_last_request(); - if (!reg_dev_ignore_cell_hint(wiphy)) - reg_num_devs_support_basehint--; + reg_update_cell_hint_num(wiphy, -1); rcu_free_regdom(get_wiphy_regdom(wiphy)); RCU_INIT_POINTER(wiphy->regd, NULL); -- 2.56.0