wireless: make the reg_notifier() void
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>
Fri, 11 Jan 2013 18:39:36 +0000 (18:39 +0000)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 14 Jan 2013 10:32:44 +0000 (11:32 +0100)
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: Luis R. Rodriguez <mcgrof@do-not-panic.com>
[move lbs_reg_notifier to not break compile]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 files changed:
drivers/net/wireless/ath/ath5k/base.c
drivers/net/wireless/ath/ath6kl/cfg80211.c
drivers/net/wireless/ath/ath9k/htc_drv_init.c
drivers/net/wireless/ath/ath9k/init.c
drivers/net/wireless/ath/carl9170/main.c
drivers/net/wireless/ath/regd.c
drivers/net/wireless/ath/regd.h
drivers/net/wireless/brcm80211/brcmsmac/channel.c
drivers/net/wireless/libertas/cfg.c
drivers/net/wireless/libertas/cfg.h
drivers/net/wireless/mwifiex/cfg80211.c
drivers/net/wireless/rtlwifi/regd.c
drivers/net/wireless/rtlwifi/regd.h
drivers/net/wireless/ti/wlcore/main.c
include/net/cfg80211.h

index 30ca0a60a64c020e6b3609bff361078e03b6a89f..1d264c0f5a9b468285296e706cfef2d367678085 100644 (file)
@@ -240,13 +240,14 @@ static const struct ath_ops ath5k_common_ops = {
 * 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 ath5k_hw *ah = hw->priv;
        struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah);
 
-       return ath_reg_notifier_apply(wiphy, request, regulatory);
+       ath_reg_notifier_apply(wiphy, request, regulatory);
 }
 
 /********************\
index 5516a8ccc3c6809589ff1d1fd8756859f504f7e9..4225cca0f198199a4e0b0e28ee5b4748cb85a45d 100644 (file)
@@ -3492,8 +3492,8 @@ void ath6kl_cfg80211_stop_all(struct ath6kl *ar)
                ath6kl_cfg80211_stop(vif);
 }
 
-static int ath6kl_cfg80211_reg_notify(struct wiphy *wiphy,
-                                     struct regulatory_request *request)
+static void ath6kl_cfg80211_reg_notify(struct wiphy *wiphy,
+                                      struct regulatory_request *request)
 {
        struct ath6kl *ar = wiphy_priv(wiphy);
        u32 rates[IEEE80211_NUM_BANDS];
@@ -3506,17 +3506,13 @@ static int ath6kl_cfg80211_reg_notify(struct wiphy *wiphy,
                   request->processed ? " processed" : "",
                   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)
-               return -EOPNOTSUPP;
+               return;
 
        ret = ath6kl_wmi_set_regdomain_cmd(ar->wmi, request->alpha2);
        if (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,
        if (ret) {
                ath6kl_err("failed to start scan for a regdomain change: %d\n",
                           ret);
-               return ret;
+               return;
        }
-
-       return 0;
 }
 
 static int ath6kl_cfg80211_vif_init(struct ath6kl_vif *vif)
index 05d5ba66cac3588f64e8f6ab0545af76fbf88cbb..e5d7958ab9485a617c60f520d2981b38b50cb7eb 100644 (file)
@@ -280,14 +280,14 @@ err:
        return ret;
 }
 
-static int ath9k_reg_notifier(struct wiphy *wiphy,
-                             struct regulatory_request *request)
+static void ath9k_reg_notifier(struct wiphy *wiphy,
+                              struct regulatory_request *request)
 {
        struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
        struct ath9k_htc_priv *priv = hw->priv;
 
-       return ath_reg_notifier_apply(wiphy, request,
-                                     ath9k_hw_regulatory(priv->ah));
+       ath_reg_notifier_apply(wiphy, request,
+                              ath9k_hw_regulatory(priv->ah));
 }
 
 static unsigned int ath9k_regread(void *hw_priv, u32 reg_offset)
index f69ef5d48c7b96119cb516259f41f2256f150747..315d6593e18ec7cca2afe78fafcba91b0252caeb 100644 (file)
@@ -302,16 +302,15 @@ static void setup_ht_cap(struct ath_softc *sc,
        ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED;
 }
 
-static int ath9k_reg_notifier(struct wiphy *wiphy,
-                             struct regulatory_request *request)
+static void ath9k_reg_notifier(struct wiphy *wiphy,
+                              struct regulatory_request *request)
 {
        struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
        struct ath_softc *sc = hw->priv;
        struct ath_hw *ah = sc->sc_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 */
        if (ah->curchan) {
@@ -321,8 +320,6 @@ static int ath9k_reg_notifier(struct wiphy *wiphy,
                sc->curtxpow = ath9k_hw_regulatory(ah)->power_limit;
                ath9k_ps_restore(sc);
        }
-
-       return ret;
 }
 
 /*
index 9d2051aeb782f44a8b54c75c2f1fd3018f96756f..aaa2699e5a8c1b7d27f6a548636467e9c61eb788 100644 (file)
@@ -1918,13 +1918,13 @@ static int carl9170_parse_eeprom(struct ar9170 *ar)
        return 0;
 }
 
-static int carl9170_reg_notifier(struct wiphy *wiphy,
-                                struct regulatory_request *request)
+static void carl9170_reg_notifier(struct wiphy *wiphy,
+                                 struct regulatory_request *request)
 {
        struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
        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)
index 7a6c79e1f8199f2a6aea995b5824935689c9f704..ccc4c718f124c2a500410cc9ed16f48841e8ec29 100644 (file)
@@ -356,9 +356,9 @@ static u16 ath_regd_find_country_by_name(char *alpha2)
        return -1;
 }
 
-int ath_reg_notifier_apply(struct wiphy *wiphy,
-                          struct regulatory_request *request,
-                          struct ath_regulatory *reg)
+void ath_reg_notifier_apply(struct wiphy *wiphy,
+                           struct regulatory_request *request,
+                           struct ath_regulatory *reg)
 {
        struct ath_common *common = container_of(reg, struct ath_common,
                                                 regulatory);
@@ -373,7 +373,7 @@ int ath_reg_notifier_apply(struct wiphy *wiphy,
         * any pending requests in the queue.
         */
        if (!request)
-               return 0;
+               return;
 
        switch (request->initiator) {
        case NL80211_REGDOM_SET_BY_CORE:
@@ -409,8 +409,6 @@ int ath_reg_notifier_apply(struct wiphy *wiphy,
 
                break;
        }
-
-       return 0;
 }
 EXPORT_SYMBOL(ath_reg_notifier_apply);
 
@@ -500,8 +498,8 @@ ath_get_regpair(int regdmn)
 static int
 ath_regd_init_wiphy(struct ath_regulatory *reg,
                    struct wiphy *wiphy,
-                   int (*reg_notifier)(struct wiphy *wiphy,
-                                       struct regulatory_request *request))
+                   void (*reg_notifier)(struct wiphy *wiphy,
+                                        struct regulatory_request *request))
 {
        const struct ieee80211_regdomain *regd;
 
@@ -621,8 +619,8 @@ static int __ath_regd_init(struct ath_regulatory *reg)
 int
 ath_regd_init(struct ath_regulatory *reg,
              struct wiphy *wiphy,
-             int (*reg_notifier)(struct wiphy *wiphy,
-                                 struct regulatory_request *request))
+             void (*reg_notifier)(struct wiphy *wiphy,
+                                  struct regulatory_request *request))
 {
        struct ath_common *common = container_of(reg, struct ath_common,
                                                 regulatory);
index 03a8268ccf21a7ca9d9c8ccf9a836c7b0d402d57..37f53bd8fcb13ad1b7f850924383a4e9a297f7af 100644 (file)
@@ -252,12 +252,12 @@ enum CountryCode {
 bool ath_is_world_regd(struct ath_regulatory *reg);
 bool ath_is_49ghz_allowed(u16 redomain);
 int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy,
-                 int (*reg_notifier)(struct wiphy *wiphy,
-                 struct regulatory_request *request));
+                 void (*reg_notifier)(struct wiphy *wiphy,
+                                      struct regulatory_request *request));
 u32 ath_regd_get_band_ctl(struct ath_regulatory *reg,
                          enum ieee80211_band band);
-int ath_reg_notifier_apply(struct wiphy *wiphy,
-                          struct regulatory_request *request,
-                          struct ath_regulatory *reg);
+void ath_reg_notifier_apply(struct wiphy *wiphy,
+                           struct regulatory_request *request,
+                           struct ath_regulatory *reg);
 
 #endif
index 4eb3f0d5210531596657696f231b5d68783dcfd1..cdb62b8ccc79c6c6ad6ea68269d3f03008d6e3e3 100644 (file)
@@ -702,8 +702,8 @@ brcms_reg_apply_beaconing_flags(struct wiphy *wiphy,
        }
 }
 
-static int brcms_reg_notifier(struct wiphy *wiphy,
-                             struct regulatory_request *request)
+static void brcms_reg_notifier(struct wiphy *wiphy,
+                              struct regulatory_request *request)
 {
        struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
        struct brcms_info *wl = hw->priv;
@@ -744,8 +744,6 @@ static int brcms_reg_notifier(struct wiphy *wiphy,
        if (wlc->pub->_nbands > 1 || wlc->band->bandtype == BRCM_BAND_2G)
                wlc_phy_chanspec_ch14_widefilter_set(wlc->band->pi,
                                        brcms_c_japan_ccode(request->alpha2));
-
-       return 0;
 }
 
 void brcms_c_regd_init(struct brcms_c_info *wlc)
index ec6d5d6b452e7aebf8b8d782460e7b0263c121a0..230f8ebbe28921f6786e250b4f88cb421c013385 100644 (file)
@@ -2132,6 +2132,21 @@ static void lbs_cfg_set_regulatory_hint(struct lbs_private *priv)
        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
@@ -2184,24 +2199,6 @@ int lbs_cfg_register(struct lbs_private *priv)
        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)
 {
        lbs_deb_enter(LBS_DEB_CFG80211);
index 558168ce634d519d67201d92c1992163550f4b4b..10995f59fe34a1796db45e914196fc7a03248c07 100644 (file)
@@ -10,9 +10,6 @@ struct wireless_dev *lbs_cfg_alloc(struct device *dev);
 int lbs_cfg_register(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_mic_failureevent(struct lbs_private *priv, u32 event);
 
index a875499f89452d7ab4a4307b72c0475d5829f470..a838ddecd91a11561d556f8cc849dd086e98571e 100644 (file)
@@ -519,8 +519,8 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy)
  *      - Set by user
  *      - Set bt Country IE
  */
-static int mwifiex_reg_notifier(struct wiphy *wiphy,
-                               struct regulatory_request *request)
+static void mwifiex_reg_notifier(struct wiphy *wiphy,
+                                struct regulatory_request *request)
 {
        struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
 
@@ -540,8 +540,6 @@ static int mwifiex_reg_notifier(struct wiphy *wiphy,
                break;
        }
        mwifiex_send_domain_info_cmd_fw(wiphy);
-
-       return 0;
 }
 
 /*
index 7e3ead774fb907c90b2f36dfc472f8e094c10c0d..d7d0d4948b01f2e804e6bcddfca93b10c7cdb312 100644 (file)
@@ -298,9 +298,9 @@ static void _rtl_reg_apply_world_flags(struct wiphy *wiphy,
        return;
 }
 
-static int _rtl_reg_notifier_apply(struct wiphy *wiphy,
-                                  struct regulatory_request *request,
-                                  struct rtl_regulatory *reg)
+static void _rtl_reg_notifier_apply(struct wiphy *wiphy,
+                                   struct regulatory_request *request,
+                                   struct rtl_regulatory *reg)
 {
        /* We always apply this */
        _rtl_reg_apply_radar_flags(wiphy);
@@ -314,8 +314,6 @@ static int _rtl_reg_notifier_apply(struct wiphy *wiphy,
                _rtl_reg_apply_world_flags(wiphy, request->initiator, reg);
                break;
        }
-
-       return 0;
 }
 
 static const struct ieee80211_regdomain *_rtl_regdomain_select(
@@ -348,9 +346,9 @@ static const struct ieee80211_regdomain *_rtl_regdomain_select(
 
 static int _rtl_regd_init_wiphy(struct rtl_regulatory *reg,
                                struct wiphy *wiphy,
-                               int (*reg_notifier) (struct wiphy *wiphy,
-                                                    struct regulatory_request *
-                                                    request))
+                               void (*reg_notifier) (struct wiphy *wiphy,
+                                                     struct regulatory_request *
+                                                     request))
 {
        const struct ieee80211_regdomain *regd;
 
@@ -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 (*reg_notifier) (struct wiphy *wiphy,
+                 void (*reg_notifier) (struct wiphy *wiphy,
                                       struct regulatory_request *request))
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -421,12 +419,12 @@ int rtl_regd_init(struct ieee80211_hw *hw,
        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 rtl_priv *rtlpriv = rtl_priv(hw);
 
        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);
 }
index 70ef2f418a44134d1fd1d810afd5f4ace4705151..4e1f4f00e6e9633ed30c59ca2220039e733fdb39 100644 (file)
@@ -55,7 +55,7 @@ enum country_code_type_t {
 };
 
 int rtl_regd_init(struct ieee80211_hw *hw,
-                 int (*reg_notifier) (struct wiphy *wiphy,
-                                      struct regulatory_request *request));
-int rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request);
+                 void (*reg_notifier) (struct wiphy *wiphy,
+                                       struct regulatory_request *request));
+void rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request);
 #endif
index d7de06359ae1f71478bdbf47ba5b9140c9083eb3..ce6e62a37e1433341d3bb2c9a5ccb2c6d2cde7d4 100644 (file)
@@ -89,8 +89,8 @@ static int wl12xx_set_authorized(struct wl1271 *wl,
        return 0;
 }
 
-static int wl1271_reg_notify(struct wiphy *wiphy,
-                            struct regulatory_request *request)
+static void wl1271_reg_notify(struct wiphy *wiphy,
+                             struct regulatory_request *request)
 {
        struct ieee80211_supported_band *band;
        struct ieee80211_channel *ch;
@@ -107,8 +107,6 @@ static int wl1271_reg_notify(struct wiphy *wiphy,
                                     IEEE80211_CHAN_PASSIVE_SCAN;
 
        }
-
-       return 0;
 }
 
 static int wl1271_set_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif,
index e5f085c8922116b16019eb1d03cd4d9e0ec67ba3..4275127da05a355607c0290771fbee755633f5a2 100644 (file)
@@ -2364,8 +2364,8 @@ struct wiphy {
        struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
 
        /* Lets us get back the wiphy on the callback */
-       int (*reg_notifier)(struct wiphy *wiphy,
-                           struct regulatory_request *request);
+       void (*reg_notifier)(struct wiphy *wiphy,
+                            struct regulatory_request *request);
 
        /* fields below are read-only, assigned by cfg80211 */