Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 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>

authored by

Luis R. Rodriguez and committed by
Johannes Berg
0c0280bd 55b183ad

+66 -90
+3 -2
drivers/net/wireless/ath/ath5k/base.c
··· 240 240 * Driver Initialization * 241 241 \***********************/ 242 242 243 - static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) 243 + static void ath5k_reg_notifier(struct wiphy *wiphy, 244 + struct regulatory_request *request) 244 245 { 245 246 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); 246 247 struct ath5k_hw *ah = hw->priv; 247 248 struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah); 248 249 249 - return ath_reg_notifier_apply(wiphy, request, regulatory); 250 + ath_reg_notifier_apply(wiphy, request, regulatory); 250 251 } 251 252 252 253 /********************\
+5 -11
drivers/net/wireless/ath/ath6kl/cfg80211.c
··· 3492 3492 ath6kl_cfg80211_stop(vif); 3493 3493 } 3494 3494 3495 - static int ath6kl_cfg80211_reg_notify(struct wiphy *wiphy, 3496 - struct regulatory_request *request) 3495 + static void ath6kl_cfg80211_reg_notify(struct wiphy *wiphy, 3496 + struct regulatory_request *request) 3497 3497 { 3498 3498 struct ath6kl *ar = wiphy_priv(wiphy); 3499 3499 u32 rates[IEEE80211_NUM_BANDS]; ··· 3506 3506 request->processed ? " processed" : "", 3507 3507 request->initiator, request->user_reg_hint_type); 3508 3508 3509 - /* 3510 - * As firmware is not able intersect regdoms, we can only listen to 3511 - * cellular hints. 3512 - */ 3513 3509 if (request->user_reg_hint_type != NL80211_USER_REG_HINT_CELL_BASE) 3514 - return -EOPNOTSUPP; 3510 + return; 3515 3511 3516 3512 ret = ath6kl_wmi_set_regdomain_cmd(ar->wmi, request->alpha2); 3517 3513 if (ret) { 3518 3514 ath6kl_err("failed to set regdomain: %d\n", ret); 3519 - return ret; 3515 + return; 3520 3516 } 3521 3517 3522 3518 /* ··· 3532 3536 if (ret) { 3533 3537 ath6kl_err("failed to start scan for a regdomain change: %d\n", 3534 3538 ret); 3535 - return ret; 3539 + return; 3536 3540 } 3537 - 3538 - return 0; 3539 3541 } 3540 3542 3541 3543 static int ath6kl_cfg80211_vif_init(struct ath6kl_vif *vif)
+4 -4
drivers/net/wireless/ath/ath9k/htc_drv_init.c
··· 280 280 return ret; 281 281 } 282 282 283 - static int ath9k_reg_notifier(struct wiphy *wiphy, 284 - struct regulatory_request *request) 283 + static void ath9k_reg_notifier(struct wiphy *wiphy, 284 + struct regulatory_request *request) 285 285 { 286 286 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); 287 287 struct ath9k_htc_priv *priv = hw->priv; 288 288 289 - return ath_reg_notifier_apply(wiphy, request, 290 - ath9k_hw_regulatory(priv->ah)); 289 + ath_reg_notifier_apply(wiphy, request, 290 + ath9k_hw_regulatory(priv->ah)); 291 291 } 292 292 293 293 static unsigned int ath9k_regread(void *hw_priv, u32 reg_offset)
+3 -6
drivers/net/wireless/ath/ath9k/init.c
··· 302 302 ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED; 303 303 } 304 304 305 - static int ath9k_reg_notifier(struct wiphy *wiphy, 306 - struct regulatory_request *request) 305 + static void ath9k_reg_notifier(struct wiphy *wiphy, 306 + struct regulatory_request *request) 307 307 { 308 308 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); 309 309 struct ath_softc *sc = hw->priv; 310 310 struct ath_hw *ah = sc->sc_ah; 311 311 struct ath_regulatory *reg = ath9k_hw_regulatory(ah); 312 - int ret; 313 312 314 - ret = ath_reg_notifier_apply(wiphy, request, reg); 313 + ath_reg_notifier_apply(wiphy, request, reg); 315 314 316 315 /* Set tx power */ 317 316 if (ah->curchan) { ··· 320 321 sc->curtxpow = ath9k_hw_regulatory(ah)->power_limit; 321 322 ath9k_ps_restore(sc); 322 323 } 323 - 324 - return ret; 325 324 } 326 325 327 326 /*
+3 -3
drivers/net/wireless/ath/carl9170/main.c
··· 1918 1918 return 0; 1919 1919 } 1920 1920 1921 - static int carl9170_reg_notifier(struct wiphy *wiphy, 1922 - struct regulatory_request *request) 1921 + static void carl9170_reg_notifier(struct wiphy *wiphy, 1922 + struct regulatory_request *request) 1923 1923 { 1924 1924 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); 1925 1925 struct ar9170 *ar = hw->priv; 1926 1926 1927 - return ath_reg_notifier_apply(wiphy, request, &ar->common.regulatory); 1927 + ath_reg_notifier_apply(wiphy, request, &ar->common.regulatory); 1928 1928 } 1929 1929 1930 1930 int carl9170_register(struct ar9170 *ar)
+8 -10
drivers/net/wireless/ath/regd.c
··· 356 356 return -1; 357 357 } 358 358 359 - int ath_reg_notifier_apply(struct wiphy *wiphy, 360 - struct regulatory_request *request, 361 - struct ath_regulatory *reg) 359 + void ath_reg_notifier_apply(struct wiphy *wiphy, 360 + struct regulatory_request *request, 361 + struct ath_regulatory *reg) 362 362 { 363 363 struct ath_common *common = container_of(reg, struct ath_common, 364 364 regulatory); ··· 373 373 * any pending requests in the queue. 374 374 */ 375 375 if (!request) 376 - return 0; 376 + return; 377 377 378 378 switch (request->initiator) { 379 379 case NL80211_REGDOM_SET_BY_CORE: ··· 409 409 410 410 break; 411 411 } 412 - 413 - return 0; 414 412 } 415 413 EXPORT_SYMBOL(ath_reg_notifier_apply); 416 414 ··· 498 500 static int 499 501 ath_regd_init_wiphy(struct ath_regulatory *reg, 500 502 struct wiphy *wiphy, 501 - int (*reg_notifier)(struct wiphy *wiphy, 502 - struct regulatory_request *request)) 503 + void (*reg_notifier)(struct wiphy *wiphy, 504 + struct regulatory_request *request)) 503 505 { 504 506 const struct ieee80211_regdomain *regd; 505 507 ··· 619 621 int 620 622 ath_regd_init(struct ath_regulatory *reg, 621 623 struct wiphy *wiphy, 622 - int (*reg_notifier)(struct wiphy *wiphy, 623 - struct regulatory_request *request)) 624 + void (*reg_notifier)(struct wiphy *wiphy, 625 + struct regulatory_request *request)) 624 626 { 625 627 struct ath_common *common = container_of(reg, struct ath_common, 626 628 regulatory);
+5 -5
drivers/net/wireless/ath/regd.h
··· 252 252 bool ath_is_world_regd(struct ath_regulatory *reg); 253 253 bool ath_is_49ghz_allowed(u16 redomain); 254 254 int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy, 255 - int (*reg_notifier)(struct wiphy *wiphy, 256 - struct regulatory_request *request)); 255 + void (*reg_notifier)(struct wiphy *wiphy, 256 + struct regulatory_request *request)); 257 257 u32 ath_regd_get_band_ctl(struct ath_regulatory *reg, 258 258 enum ieee80211_band band); 259 - int ath_reg_notifier_apply(struct wiphy *wiphy, 260 - struct regulatory_request *request, 261 - struct ath_regulatory *reg); 259 + void ath_reg_notifier_apply(struct wiphy *wiphy, 260 + struct regulatory_request *request, 261 + struct ath_regulatory *reg); 262 262 263 263 #endif
+2 -4
drivers/net/wireless/brcm80211/brcmsmac/channel.c
··· 702 702 } 703 703 } 704 704 705 - static int brcms_reg_notifier(struct wiphy *wiphy, 706 - struct regulatory_request *request) 705 + static void brcms_reg_notifier(struct wiphy *wiphy, 706 + struct regulatory_request *request) 707 707 { 708 708 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); 709 709 struct brcms_info *wl = hw->priv; ··· 744 744 if (wlc->pub->_nbands > 1 || wlc->band->bandtype == BRCM_BAND_2G) 745 745 wlc_phy_chanspec_ch14_widefilter_set(wlc->band->pi, 746 746 brcms_c_japan_ccode(request->alpha2)); 747 - 748 - return 0; 749 747 } 750 748 751 749 void brcms_c_regd_init(struct brcms_c_info *wlc)
+15 -18
drivers/net/wireless/libertas/cfg.c
··· 2132 2132 lbs_deb_leave(LBS_DEB_CFG80211); 2133 2133 } 2134 2134 2135 + static void lbs_reg_notifier(struct wiphy *wiphy, 2136 + struct regulatory_request *request) 2137 + { 2138 + struct lbs_private *priv = wiphy_priv(wiphy); 2139 + 2140 + lbs_deb_enter_args(LBS_DEB_CFG80211, "cfg80211 regulatory domain " 2141 + "callback for domain %c%c\n", request->alpha2[0], 2142 + request->alpha2[1]); 2143 + 2144 + memcpy(priv->country_code, request->alpha2, sizeof(request->alpha2)); 2145 + if (lbs_iface_active(priv)) 2146 + lbs_set_11d_domain_info(priv); 2147 + 2148 + lbs_deb_leave(LBS_DEB_CFG80211); 2149 + } 2135 2150 2136 2151 /* 2137 2152 * This function get's called after lbs_setup_firmware() determined the ··· 2196 2181 lbs_cfg_set_regulatory_hint(priv); 2197 2182 2198 2183 lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); 2199 - return ret; 2200 - } 2201 - 2202 - int lbs_reg_notifier(struct wiphy *wiphy, 2203 - struct regulatory_request *request) 2204 - { 2205 - struct lbs_private *priv = wiphy_priv(wiphy); 2206 - int ret = 0; 2207 - 2208 - lbs_deb_enter_args(LBS_DEB_CFG80211, "cfg80211 regulatory domain " 2209 - "callback for domain %c%c\n", request->alpha2[0], 2210 - request->alpha2[1]); 2211 - 2212 - memcpy(priv->country_code, request->alpha2, sizeof(request->alpha2)); 2213 - if (lbs_iface_active(priv)) 2214 - ret = lbs_set_11d_domain_info(priv); 2215 - 2216 - lbs_deb_leave(LBS_DEB_CFG80211); 2217 2184 return ret; 2218 2185 } 2219 2186
-3
drivers/net/wireless/libertas/cfg.h
··· 10 10 int lbs_cfg_register(struct lbs_private *priv); 11 11 void lbs_cfg_free(struct lbs_private *priv); 12 12 13 - int lbs_reg_notifier(struct wiphy *wiphy, 14 - struct regulatory_request *request); 15 - 16 13 void lbs_send_disconnect_notification(struct lbs_private *priv); 17 14 void lbs_send_mic_failureevent(struct lbs_private *priv, u32 event); 18 15
+2 -4
drivers/net/wireless/mwifiex/cfg80211.c
··· 519 519 * - Set by user 520 520 * - Set bt Country IE 521 521 */ 522 - static int mwifiex_reg_notifier(struct wiphy *wiphy, 523 - struct regulatory_request *request) 522 + static void mwifiex_reg_notifier(struct wiphy *wiphy, 523 + struct regulatory_request *request) 524 524 { 525 525 struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); 526 526 ··· 540 540 break; 541 541 } 542 542 mwifiex_send_domain_info_cmd_fw(wiphy); 543 - 544 - return 0; 545 543 } 546 544 547 545 /*
+9 -11
drivers/net/wireless/rtlwifi/regd.c
··· 298 298 return; 299 299 } 300 300 301 - static int _rtl_reg_notifier_apply(struct wiphy *wiphy, 302 - struct regulatory_request *request, 303 - struct rtl_regulatory *reg) 301 + static void _rtl_reg_notifier_apply(struct wiphy *wiphy, 302 + struct regulatory_request *request, 303 + struct rtl_regulatory *reg) 304 304 { 305 305 /* We always apply this */ 306 306 _rtl_reg_apply_radar_flags(wiphy); ··· 314 314 _rtl_reg_apply_world_flags(wiphy, request->initiator, reg); 315 315 break; 316 316 } 317 - 318 - return 0; 319 317 } 320 318 321 319 static const struct ieee80211_regdomain *_rtl_regdomain_select( ··· 346 348 347 349 static int _rtl_regd_init_wiphy(struct rtl_regulatory *reg, 348 350 struct wiphy *wiphy, 349 - int (*reg_notifier) (struct wiphy *wiphy, 350 - struct regulatory_request * 351 - request)) 351 + void (*reg_notifier) (struct wiphy *wiphy, 352 + struct regulatory_request * 353 + request)) 352 354 { 353 355 const struct ieee80211_regdomain *regd; 354 356 ··· 377 379 } 378 380 379 381 int rtl_regd_init(struct ieee80211_hw *hw, 380 - int (*reg_notifier) (struct wiphy *wiphy, 382 + void (*reg_notifier) (struct wiphy *wiphy, 381 383 struct regulatory_request *request)) 382 384 { 383 385 struct rtl_priv *rtlpriv = rtl_priv(hw); ··· 419 421 return 0; 420 422 } 421 423 422 - int rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) 424 + void rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) 423 425 { 424 426 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); 425 427 struct rtl_priv *rtlpriv = rtl_priv(hw); 426 428 427 429 RT_TRACE(rtlpriv, COMP_REGD, DBG_LOUD, "\n"); 428 430 429 - return _rtl_reg_notifier_apply(wiphy, request, &rtlpriv->regd); 431 + _rtl_reg_notifier_apply(wiphy, request, &rtlpriv->regd); 430 432 }
+3 -3
drivers/net/wireless/rtlwifi/regd.h
··· 55 55 }; 56 56 57 57 int rtl_regd_init(struct ieee80211_hw *hw, 58 - int (*reg_notifier) (struct wiphy *wiphy, 59 - struct regulatory_request *request)); 60 - int rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request); 58 + void (*reg_notifier) (struct wiphy *wiphy, 59 + struct regulatory_request *request)); 60 + void rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request); 61 61 #endif
+2 -4
drivers/net/wireless/ti/wlcore/main.c
··· 89 89 return 0; 90 90 } 91 91 92 - static int wl1271_reg_notify(struct wiphy *wiphy, 93 - struct regulatory_request *request) 92 + static void wl1271_reg_notify(struct wiphy *wiphy, 93 + struct regulatory_request *request) 94 94 { 95 95 struct ieee80211_supported_band *band; 96 96 struct ieee80211_channel *ch; ··· 107 107 IEEE80211_CHAN_PASSIVE_SCAN; 108 108 109 109 } 110 - 111 - return 0; 112 110 } 113 111 114 112 static int wl1271_set_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif,
+2 -2
include/net/cfg80211.h
··· 2364 2364 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 2365 2365 2366 2366 /* Lets us get back the wiphy on the callback */ 2367 - int (*reg_notifier)(struct wiphy *wiphy, 2368 - struct regulatory_request *request); 2367 + void (*reg_notifier)(struct wiphy *wiphy, 2368 + struct regulatory_request *request); 2369 2369 2370 2370 /* fields below are read-only, assigned by cfg80211 */ 2371 2371