Commit 0c0280bd authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by Johannes Berg

wireless: make the reg_notifier() void

The reg_notifier()'s return value need not be checked
as it is only supposed to do post regulatory work and
that should never fail. Any behaviour to regulatory
that needs to be considered before cfg80211 does work
to a driver should be specified by using the already
existing flags, the reg_notifier() just does post
processing should it find it needs to.

Also make lbs_reg_notifier static.
Signed-off-by: default avatarLuis R. Rodriguez <mcgrof@do-not-panic.com>
[move lbs_reg_notifier to not break compile]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 55b183ad
...@@ -240,13 +240,14 @@ static const struct ath_ops ath5k_common_ops = { ...@@ -240,13 +240,14 @@ static const struct ath_ops ath5k_common_ops = {
* Driver Initialization * * Driver Initialization *
\***********************/ \***********************/
static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) static void ath5k_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *request)
{ {
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct ath5k_hw *ah = hw->priv; struct ath5k_hw *ah = hw->priv;
struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah); struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah);
return ath_reg_notifier_apply(wiphy, request, regulatory); ath_reg_notifier_apply(wiphy, request, regulatory);
} }
/********************\ /********************\
......
...@@ -3492,7 +3492,7 @@ void ath6kl_cfg80211_stop_all(struct ath6kl *ar) ...@@ -3492,7 +3492,7 @@ void ath6kl_cfg80211_stop_all(struct ath6kl *ar)
ath6kl_cfg80211_stop(vif); ath6kl_cfg80211_stop(vif);
} }
static int ath6kl_cfg80211_reg_notify(struct wiphy *wiphy, static void ath6kl_cfg80211_reg_notify(struct wiphy *wiphy,
struct regulatory_request *request) struct regulatory_request *request)
{ {
struct ath6kl *ar = wiphy_priv(wiphy); struct ath6kl *ar = wiphy_priv(wiphy);
...@@ -3506,17 +3506,13 @@ static int ath6kl_cfg80211_reg_notify(struct wiphy *wiphy, ...@@ -3506,17 +3506,13 @@ static int ath6kl_cfg80211_reg_notify(struct wiphy *wiphy,
request->processed ? " processed" : "", request->processed ? " processed" : "",
request->initiator, request->user_reg_hint_type); request->initiator, request->user_reg_hint_type);
/*
* As firmware is not able intersect regdoms, we can only listen to
* cellular hints.
*/
if (request->user_reg_hint_type != NL80211_USER_REG_HINT_CELL_BASE) if (request->user_reg_hint_type != NL80211_USER_REG_HINT_CELL_BASE)
return -EOPNOTSUPP; return;
ret = ath6kl_wmi_set_regdomain_cmd(ar->wmi, request->alpha2); ret = ath6kl_wmi_set_regdomain_cmd(ar->wmi, request->alpha2);
if (ret) { if (ret) {
ath6kl_err("failed to set regdomain: %d\n", ret); ath6kl_err("failed to set regdomain: %d\n", ret);
return ret; return;
} }
/* /*
...@@ -3536,10 +3532,8 @@ static int ath6kl_cfg80211_reg_notify(struct wiphy *wiphy, ...@@ -3536,10 +3532,8 @@ static int ath6kl_cfg80211_reg_notify(struct wiphy *wiphy,
if (ret) { if (ret) {
ath6kl_err("failed to start scan for a regdomain change: %d\n", ath6kl_err("failed to start scan for a regdomain change: %d\n",
ret); ret);
return ret; return;
} }
return 0;
} }
static int ath6kl_cfg80211_vif_init(struct ath6kl_vif *vif) static int ath6kl_cfg80211_vif_init(struct ath6kl_vif *vif)
......
...@@ -280,13 +280,13 @@ static int ath9k_init_htc_services(struct ath9k_htc_priv *priv, u16 devid, ...@@ -280,13 +280,13 @@ static int ath9k_init_htc_services(struct ath9k_htc_priv *priv, u16 devid,
return ret; return ret;
} }
static int ath9k_reg_notifier(struct wiphy *wiphy, static void ath9k_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *request) struct regulatory_request *request)
{ {
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct ath9k_htc_priv *priv = hw->priv; struct ath9k_htc_priv *priv = hw->priv;
return ath_reg_notifier_apply(wiphy, request, ath_reg_notifier_apply(wiphy, request,
ath9k_hw_regulatory(priv->ah)); ath9k_hw_regulatory(priv->ah));
} }
......
...@@ -302,16 +302,15 @@ static void setup_ht_cap(struct ath_softc *sc, ...@@ -302,16 +302,15 @@ static void setup_ht_cap(struct ath_softc *sc,
ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED; ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED;
} }
static int ath9k_reg_notifier(struct wiphy *wiphy, static void ath9k_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *request) struct regulatory_request *request)
{ {
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
struct ath_regulatory *reg = ath9k_hw_regulatory(ah); struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
int ret;
ret = ath_reg_notifier_apply(wiphy, request, reg); ath_reg_notifier_apply(wiphy, request, reg);
/* Set tx power */ /* Set tx power */
if (ah->curchan) { if (ah->curchan) {
...@@ -321,8 +320,6 @@ static int ath9k_reg_notifier(struct wiphy *wiphy, ...@@ -321,8 +320,6 @@ static int ath9k_reg_notifier(struct wiphy *wiphy,
sc->curtxpow = ath9k_hw_regulatory(ah)->power_limit; sc->curtxpow = ath9k_hw_regulatory(ah)->power_limit;
ath9k_ps_restore(sc); ath9k_ps_restore(sc);
} }
return ret;
} }
/* /*
......
...@@ -1918,13 +1918,13 @@ static int carl9170_parse_eeprom(struct ar9170 *ar) ...@@ -1918,13 +1918,13 @@ static int carl9170_parse_eeprom(struct ar9170 *ar)
return 0; return 0;
} }
static int carl9170_reg_notifier(struct wiphy *wiphy, static void carl9170_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *request) struct regulatory_request *request)
{ {
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct ar9170 *ar = hw->priv; struct ar9170 *ar = hw->priv;
return ath_reg_notifier_apply(wiphy, request, &ar->common.regulatory); ath_reg_notifier_apply(wiphy, request, &ar->common.regulatory);
} }
int carl9170_register(struct ar9170 *ar) int carl9170_register(struct ar9170 *ar)
......
...@@ -356,7 +356,7 @@ static u16 ath_regd_find_country_by_name(char *alpha2) ...@@ -356,7 +356,7 @@ static u16 ath_regd_find_country_by_name(char *alpha2)
return -1; return -1;
} }
int ath_reg_notifier_apply(struct wiphy *wiphy, void ath_reg_notifier_apply(struct wiphy *wiphy,
struct regulatory_request *request, struct regulatory_request *request,
struct ath_regulatory *reg) struct ath_regulatory *reg)
{ {
...@@ -373,7 +373,7 @@ int ath_reg_notifier_apply(struct wiphy *wiphy, ...@@ -373,7 +373,7 @@ int ath_reg_notifier_apply(struct wiphy *wiphy,
* any pending requests in the queue. * any pending requests in the queue.
*/ */
if (!request) if (!request)
return 0; return;
switch (request->initiator) { switch (request->initiator) {
case NL80211_REGDOM_SET_BY_CORE: case NL80211_REGDOM_SET_BY_CORE:
...@@ -409,8 +409,6 @@ int ath_reg_notifier_apply(struct wiphy *wiphy, ...@@ -409,8 +409,6 @@ int ath_reg_notifier_apply(struct wiphy *wiphy,
break; break;
} }
return 0;
} }
EXPORT_SYMBOL(ath_reg_notifier_apply); EXPORT_SYMBOL(ath_reg_notifier_apply);
...@@ -500,7 +498,7 @@ ath_get_regpair(int regdmn) ...@@ -500,7 +498,7 @@ ath_get_regpair(int regdmn)
static int static int
ath_regd_init_wiphy(struct ath_regulatory *reg, ath_regd_init_wiphy(struct ath_regulatory *reg,
struct wiphy *wiphy, struct wiphy *wiphy,
int (*reg_notifier)(struct wiphy *wiphy, void (*reg_notifier)(struct wiphy *wiphy,
struct regulatory_request *request)) struct regulatory_request *request))
{ {
const struct ieee80211_regdomain *regd; const struct ieee80211_regdomain *regd;
...@@ -621,7 +619,7 @@ static int __ath_regd_init(struct ath_regulatory *reg) ...@@ -621,7 +619,7 @@ static int __ath_regd_init(struct ath_regulatory *reg)
int int
ath_regd_init(struct ath_regulatory *reg, ath_regd_init(struct ath_regulatory *reg,
struct wiphy *wiphy, struct wiphy *wiphy,
int (*reg_notifier)(struct wiphy *wiphy, void (*reg_notifier)(struct wiphy *wiphy,
struct regulatory_request *request)) struct regulatory_request *request))
{ {
struct ath_common *common = container_of(reg, struct ath_common, struct ath_common *common = container_of(reg, struct ath_common,
......
...@@ -252,11 +252,11 @@ enum CountryCode { ...@@ -252,11 +252,11 @@ enum CountryCode {
bool ath_is_world_regd(struct ath_regulatory *reg); bool ath_is_world_regd(struct ath_regulatory *reg);
bool ath_is_49ghz_allowed(u16 redomain); bool ath_is_49ghz_allowed(u16 redomain);
int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy, int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy,
int (*reg_notifier)(struct wiphy *wiphy, void (*reg_notifier)(struct wiphy *wiphy,
struct regulatory_request *request)); struct regulatory_request *request));
u32 ath_regd_get_band_ctl(struct ath_regulatory *reg, u32 ath_regd_get_band_ctl(struct ath_regulatory *reg,
enum ieee80211_band band); enum ieee80211_band band);
int ath_reg_notifier_apply(struct wiphy *wiphy, void ath_reg_notifier_apply(struct wiphy *wiphy,
struct regulatory_request *request, struct regulatory_request *request,
struct ath_regulatory *reg); struct ath_regulatory *reg);
......
...@@ -702,7 +702,7 @@ brcms_reg_apply_beaconing_flags(struct wiphy *wiphy, ...@@ -702,7 +702,7 @@ brcms_reg_apply_beaconing_flags(struct wiphy *wiphy,
} }
} }
static int brcms_reg_notifier(struct wiphy *wiphy, static void brcms_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *request) struct regulatory_request *request)
{ {
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
...@@ -744,8 +744,6 @@ static int brcms_reg_notifier(struct wiphy *wiphy, ...@@ -744,8 +744,6 @@ static int brcms_reg_notifier(struct wiphy *wiphy,
if (wlc->pub->_nbands > 1 || wlc->band->bandtype == BRCM_BAND_2G) if (wlc->pub->_nbands > 1 || wlc->band->bandtype == BRCM_BAND_2G)
wlc_phy_chanspec_ch14_widefilter_set(wlc->band->pi, wlc_phy_chanspec_ch14_widefilter_set(wlc->band->pi,
brcms_c_japan_ccode(request->alpha2)); brcms_c_japan_ccode(request->alpha2));
return 0;
} }
void brcms_c_regd_init(struct brcms_c_info *wlc) void brcms_c_regd_init(struct brcms_c_info *wlc)
......
...@@ -2132,6 +2132,21 @@ static void lbs_cfg_set_regulatory_hint(struct lbs_private *priv) ...@@ -2132,6 +2132,21 @@ static void lbs_cfg_set_regulatory_hint(struct lbs_private *priv)
lbs_deb_leave(LBS_DEB_CFG80211); lbs_deb_leave(LBS_DEB_CFG80211);
} }
static void lbs_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *request)
{
struct lbs_private *priv = wiphy_priv(wiphy);
lbs_deb_enter_args(LBS_DEB_CFG80211, "cfg80211 regulatory domain "
"callback for domain %c%c\n", request->alpha2[0],
request->alpha2[1]);
memcpy(priv->country_code, request->alpha2, sizeof(request->alpha2));
if (lbs_iface_active(priv))
lbs_set_11d_domain_info(priv);
lbs_deb_leave(LBS_DEB_CFG80211);
}
/* /*
* This function get's called after lbs_setup_firmware() determined the * This function get's called after lbs_setup_firmware() determined the
...@@ -2184,24 +2199,6 @@ int lbs_cfg_register(struct lbs_private *priv) ...@@ -2184,24 +2199,6 @@ int lbs_cfg_register(struct lbs_private *priv)
return ret; return ret;
} }
int lbs_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *request)
{
struct lbs_private *priv = wiphy_priv(wiphy);
int ret = 0;
lbs_deb_enter_args(LBS_DEB_CFG80211, "cfg80211 regulatory domain "
"callback for domain %c%c\n", request->alpha2[0],
request->alpha2[1]);
memcpy(priv->country_code, request->alpha2, sizeof(request->alpha2));
if (lbs_iface_active(priv))
ret = lbs_set_11d_domain_info(priv);
lbs_deb_leave(LBS_DEB_CFG80211);
return ret;
}
void lbs_scan_deinit(struct lbs_private *priv) void lbs_scan_deinit(struct lbs_private *priv)
{ {
lbs_deb_enter(LBS_DEB_CFG80211); lbs_deb_enter(LBS_DEB_CFG80211);
......
...@@ -10,9 +10,6 @@ struct wireless_dev *lbs_cfg_alloc(struct device *dev); ...@@ -10,9 +10,6 @@ struct wireless_dev *lbs_cfg_alloc(struct device *dev);
int lbs_cfg_register(struct lbs_private *priv); int lbs_cfg_register(struct lbs_private *priv);
void lbs_cfg_free(struct lbs_private *priv); void lbs_cfg_free(struct lbs_private *priv);
int lbs_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *request);
void lbs_send_disconnect_notification(struct lbs_private *priv); void lbs_send_disconnect_notification(struct lbs_private *priv);
void lbs_send_mic_failureevent(struct lbs_private *priv, u32 event); void lbs_send_mic_failureevent(struct lbs_private *priv, u32 event);
......
...@@ -519,7 +519,7 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy) ...@@ -519,7 +519,7 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy)
* - Set by user * - Set by user
* - Set bt Country IE * - Set bt Country IE
*/ */
static int mwifiex_reg_notifier(struct wiphy *wiphy, static void mwifiex_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *request) struct regulatory_request *request)
{ {
struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
...@@ -540,8 +540,6 @@ static int mwifiex_reg_notifier(struct wiphy *wiphy, ...@@ -540,8 +540,6 @@ static int mwifiex_reg_notifier(struct wiphy *wiphy,
break; break;
} }
mwifiex_send_domain_info_cmd_fw(wiphy); mwifiex_send_domain_info_cmd_fw(wiphy);
return 0;
} }
/* /*
......
...@@ -298,7 +298,7 @@ static void _rtl_reg_apply_world_flags(struct wiphy *wiphy, ...@@ -298,7 +298,7 @@ static void _rtl_reg_apply_world_flags(struct wiphy *wiphy,
return; return;
} }
static int _rtl_reg_notifier_apply(struct wiphy *wiphy, static void _rtl_reg_notifier_apply(struct wiphy *wiphy,
struct regulatory_request *request, struct regulatory_request *request,
struct rtl_regulatory *reg) struct rtl_regulatory *reg)
{ {
...@@ -314,8 +314,6 @@ static int _rtl_reg_notifier_apply(struct wiphy *wiphy, ...@@ -314,8 +314,6 @@ static int _rtl_reg_notifier_apply(struct wiphy *wiphy,
_rtl_reg_apply_world_flags(wiphy, request->initiator, reg); _rtl_reg_apply_world_flags(wiphy, request->initiator, reg);
break; break;
} }
return 0;
} }
static const struct ieee80211_regdomain *_rtl_regdomain_select( static const struct ieee80211_regdomain *_rtl_regdomain_select(
...@@ -348,7 +346,7 @@ static const struct ieee80211_regdomain *_rtl_regdomain_select( ...@@ -348,7 +346,7 @@ static const struct ieee80211_regdomain *_rtl_regdomain_select(
static int _rtl_regd_init_wiphy(struct rtl_regulatory *reg, static int _rtl_regd_init_wiphy(struct rtl_regulatory *reg,
struct wiphy *wiphy, struct wiphy *wiphy,
int (*reg_notifier) (struct wiphy *wiphy, void (*reg_notifier) (struct wiphy *wiphy,
struct regulatory_request * struct regulatory_request *
request)) request))
{ {
...@@ -379,7 +377,7 @@ static struct country_code_to_enum_rd *_rtl_regd_find_country(u16 countrycode) ...@@ -379,7 +377,7 @@ static struct country_code_to_enum_rd *_rtl_regd_find_country(u16 countrycode)
} }
int rtl_regd_init(struct ieee80211_hw *hw, int rtl_regd_init(struct ieee80211_hw *hw,
int (*reg_notifier) (struct wiphy *wiphy, void (*reg_notifier) (struct wiphy *wiphy,
struct regulatory_request *request)) struct regulatory_request *request))
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
...@@ -421,12 +419,12 @@ int rtl_regd_init(struct ieee80211_hw *hw, ...@@ -421,12 +419,12 @@ int rtl_regd_init(struct ieee80211_hw *hw,
return 0; return 0;
} }
int rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) void rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
{ {
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
RT_TRACE(rtlpriv, COMP_REGD, DBG_LOUD, "\n"); RT_TRACE(rtlpriv, COMP_REGD, DBG_LOUD, "\n");
return _rtl_reg_notifier_apply(wiphy, request, &rtlpriv->regd); _rtl_reg_notifier_apply(wiphy, request, &rtlpriv->regd);
} }
...@@ -55,7 +55,7 @@ enum country_code_type_t { ...@@ -55,7 +55,7 @@ enum country_code_type_t {
}; };
int rtl_regd_init(struct ieee80211_hw *hw, int rtl_regd_init(struct ieee80211_hw *hw,
int (*reg_notifier) (struct wiphy *wiphy, void (*reg_notifier) (struct wiphy *wiphy,
struct regulatory_request *request)); struct regulatory_request *request));
int rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request); void rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request);
#endif #endif
...@@ -89,7 +89,7 @@ static int wl12xx_set_authorized(struct wl1271 *wl, ...@@ -89,7 +89,7 @@ static int wl12xx_set_authorized(struct wl1271 *wl,
return 0; return 0;
} }
static int wl1271_reg_notify(struct wiphy *wiphy, static void wl1271_reg_notify(struct wiphy *wiphy,
struct regulatory_request *request) struct regulatory_request *request)
{ {
struct ieee80211_supported_band *band; struct ieee80211_supported_band *band;
...@@ -107,8 +107,6 @@ static int wl1271_reg_notify(struct wiphy *wiphy, ...@@ -107,8 +107,6 @@ static int wl1271_reg_notify(struct wiphy *wiphy,
IEEE80211_CHAN_PASSIVE_SCAN; IEEE80211_CHAN_PASSIVE_SCAN;
} }
return 0;
} }
static int wl1271_set_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif, static int wl1271_set_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif,
......
...@@ -2364,7 +2364,7 @@ struct wiphy { ...@@ -2364,7 +2364,7 @@ struct wiphy {
struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
/* Lets us get back the wiphy on the callback */ /* Lets us get back the wiphy on the callback */
int (*reg_notifier)(struct wiphy *wiphy, void (*reg_notifier)(struct wiphy *wiphy,
struct regulatory_request *request); struct regulatory_request *request);
/* fields below are read-only, assigned by cfg80211 */ /* fields below are read-only, assigned by cfg80211 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment