Commit 191a99b7 authored by Bob Copeland's avatar Bob Copeland Committed by John W. Linville

ath9k: move common regulatory code out of if() branches

Both branches of the regulatory check in ath_attach() set up a
custom regulatory domain and apply radar and world flags, so extract
those into a single path.

While at it, fix a couple of spelling errors and an unnecessary extra
pointer traversal.
Signed-off-by: default avatarBob Copeland <me@bobcopeland.com>
Acked-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 65fe4656
...@@ -1570,6 +1570,7 @@ static int ath_init(u16 devid, struct ath_softc *sc) ...@@ -1570,6 +1570,7 @@ static int ath_init(u16 devid, struct ath_softc *sc)
int ath_attach(u16 devid, struct ath_softc *sc) int ath_attach(u16 devid, struct ath_softc *sc)
{ {
struct ieee80211_hw *hw = sc->hw; struct ieee80211_hw *hw = sc->hw;
const struct ieee80211_regdomain *regd;
int error = 0, i; int error = 0, i;
DPRINTF(sc, ATH_DBG_CONFIG, "Attach ATH hw\n"); DPRINTF(sc, ATH_DBG_CONFIG, "Attach ATH hw\n");
...@@ -1640,25 +1641,20 @@ int ath_attach(u16 devid, struct ath_softc *sc) ...@@ -1640,25 +1641,20 @@ int ath_attach(u16 devid, struct ath_softc *sc)
#endif #endif
if (ath9k_is_world_regd(sc->sc_ah)) { if (ath9k_is_world_regd(sc->sc_ah)) {
/* Anything applied here (prior to wiphy registratoin) gets /* Anything applied here (prior to wiphy registration) gets
* saved on the wiphy orig_* parameters */ * saved on the wiphy orig_* parameters */
const struct ieee80211_regdomain *regd = regd = ath9k_world_regdomain(sc->sc_ah);
ath9k_world_regdomain(sc->sc_ah);
hw->wiphy->custom_regulatory = true; hw->wiphy->custom_regulatory = true;
hw->wiphy->strict_regulatory = false; hw->wiphy->strict_regulatory = false;
wiphy_apply_custom_regulatory(sc->hw->wiphy, regd);
ath9k_reg_apply_radar_flags(hw->wiphy);
ath9k_reg_apply_world_flags(hw->wiphy, REGDOM_SET_BY_INIT);
} else { } else {
/* This gets applied in the case of the absense of CRDA, /* This gets applied in the case of the absense of CRDA,
* its our own custom world regulatory domain, similar to * it's our own custom world regulatory domain, similar to
* cfg80211's but we enable passive scanning */ * cfg80211's but we enable passive scanning */
const struct ieee80211_regdomain *regd = regd = ath9k_default_world_regdomain();
ath9k_default_world_regdomain();
wiphy_apply_custom_regulatory(sc->hw->wiphy, regd);
ath9k_reg_apply_radar_flags(hw->wiphy);
ath9k_reg_apply_world_flags(hw->wiphy, REGDOM_SET_BY_INIT);
} }
wiphy_apply_custom_regulatory(hw->wiphy, regd);
ath9k_reg_apply_radar_flags(hw->wiphy);
ath9k_reg_apply_world_flags(hw->wiphy, REGDOM_SET_BY_INIT);
error = ieee80211_register_hw(hw); error = ieee80211_register_hw(hw);
......
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