aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2009-02-12 13:38:58 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:52:33 -0500
commit191a99b748a080d9ec896f35352da741b556119e (patch)
treeebaf331f338bb7a47dea80fc7f5f309df93ea147 /drivers/net
parent65fe4656b79d5f91e7c7416c9a2994301ccc15e7 (diff)
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: Bob Copeland <me@bobcopeland.com> Acked-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath9k/main.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 32cdb246a8f2..cd9bab54dd70 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -1570,6 +1570,7 @@ bad:
1570int ath_attach(u16 devid, struct ath_softc *sc) 1570int ath_attach(u16 devid, struct ath_softc *sc)
1571{ 1571{
1572 struct ieee80211_hw *hw = sc->hw; 1572 struct ieee80211_hw *hw = sc->hw;
1573 const struct ieee80211_regdomain *regd;
1573 int error = 0, i; 1574 int error = 0, i;
1574 1575
1575 DPRINTF(sc, ATH_DBG_CONFIG, "Attach ATH hw\n"); 1576 DPRINTF(sc, ATH_DBG_CONFIG, "Attach ATH hw\n");
@@ -1640,25 +1641,20 @@ int ath_attach(u16 devid, struct ath_softc *sc)
1640#endif 1641#endif
1641 1642
1642 if (ath9k_is_world_regd(sc->sc_ah)) { 1643 if (ath9k_is_world_regd(sc->sc_ah)) {
1643 /* Anything applied here (prior to wiphy registratoin) gets 1644 /* Anything applied here (prior to wiphy registration) gets
1644 * saved on the wiphy orig_* parameters */ 1645 * saved on the wiphy orig_* parameters */
1645 const struct ieee80211_regdomain *regd = 1646 regd = ath9k_world_regdomain(sc->sc_ah);
1646 ath9k_world_regdomain(sc->sc_ah);
1647 hw->wiphy->custom_regulatory = true; 1647 hw->wiphy->custom_regulatory = true;
1648 hw->wiphy->strict_regulatory = false; 1648 hw->wiphy->strict_regulatory = false;
1649 wiphy_apply_custom_regulatory(sc->hw->wiphy, regd);
1650 ath9k_reg_apply_radar_flags(hw->wiphy);
1651 ath9k_reg_apply_world_flags(hw->wiphy, REGDOM_SET_BY_INIT);
1652 } else { 1649 } else {
1653 /* This gets applied in the case of the absense of CRDA, 1650 /* This gets applied in the case of the absense of CRDA,
1654 * its our own custom world regulatory domain, similar to 1651 * it's our own custom world regulatory domain, similar to
1655 * cfg80211's but we enable passive scanning */ 1652 * cfg80211's but we enable passive scanning */
1656 const struct ieee80211_regdomain *regd = 1653 regd = ath9k_default_world_regdomain();
1657 ath9k_default_world_regdomain();
1658 wiphy_apply_custom_regulatory(sc->hw->wiphy, regd);
1659 ath9k_reg_apply_radar_flags(hw->wiphy);
1660 ath9k_reg_apply_world_flags(hw->wiphy, REGDOM_SET_BY_INIT);
1661 } 1654 }
1655 wiphy_apply_custom_regulatory(hw->wiphy, regd);
1656 ath9k_reg_apply_radar_flags(hw->wiphy);
1657 ath9k_reg_apply_world_flags(hw->wiphy, REGDOM_SET_BY_INIT);
1662 1658
1663 error = ieee80211_register_hw(hw); 1659 error = ieee80211_register_hw(hw);
1664 1660