diff options
author | Bob Copeland <me@bobcopeland.com> | 2009-03-30 22:30:30 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-04-22 16:54:37 -0400 |
commit | e3bb249be89dd387e78ca382d08fad31745edac9 (patch) | |
tree | 9050d6502ace74b8c5c3577825d1b91011fce8be /drivers/net/wireless/ath9k/main.c | |
parent | 3a702e49c03ba959e3f5bb2b74ec9921a81c8c98 (diff) |
ath: move more setup code into ath_regd_init
Setup the wiphy regulatory parameters when first initializing the
Atheros regulatory module. We can remove five exported symbols this
way and simplify the driver code for both ath5k and ath9k.
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/main.c')
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index d779f00c9b9d..8b6a7ea4e59b 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -1352,6 +1352,17 @@ void ath_detach(struct ath_softc *sc) | |||
1352 | ath9k_ps_restore(sc); | 1352 | ath9k_ps_restore(sc); |
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | static int ath9k_reg_notifier(struct wiphy *wiphy, | ||
1356 | struct regulatory_request *request) | ||
1357 | { | ||
1358 | struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); | ||
1359 | struct ath_wiphy *aphy = hw->priv; | ||
1360 | struct ath_softc *sc = aphy->sc; | ||
1361 | struct ath_regulatory *reg = &sc->sc_ah->regulatory; | ||
1362 | |||
1363 | return ath_reg_notifier_apply(wiphy, request, reg); | ||
1364 | } | ||
1365 | |||
1355 | static int ath_init(u16 devid, struct ath_softc *sc) | 1366 | static int ath_init(u16 devid, struct ath_softc *sc) |
1356 | { | 1367 | { |
1357 | struct ath_hw *ah = NULL; | 1368 | struct ath_hw *ah = NULL; |
@@ -1406,7 +1417,8 @@ static int ath_init(u16 devid, struct ath_softc *sc) | |||
1406 | for (i = 0; i < sc->keymax; i++) | 1417 | for (i = 0; i < sc->keymax; i++) |
1407 | ath9k_hw_keyreset(ah, (u16) i); | 1418 | ath9k_hw_keyreset(ah, (u16) i); |
1408 | 1419 | ||
1409 | if (ath_regd_init(&sc->sc_ah->regulatory)) | 1420 | if (ath_regd_init(&sc->sc_ah->regulatory, sc->hw->wiphy, |
1421 | ath9k_reg_notifier)) | ||
1410 | goto bad; | 1422 | goto bad; |
1411 | 1423 | ||
1412 | /* default to MONITOR mode */ | 1424 | /* default to MONITOR mode */ |
@@ -1570,17 +1582,6 @@ bad: | |||
1570 | return error; | 1582 | return error; |
1571 | } | 1583 | } |
1572 | 1584 | ||
1573 | static int ath9k_reg_notifier(struct wiphy *wiphy, | ||
1574 | struct regulatory_request *request) | ||
1575 | { | ||
1576 | struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); | ||
1577 | struct ath_wiphy *aphy = hw->priv; | ||
1578 | struct ath_softc *sc = aphy->sc; | ||
1579 | struct ath_regulatory *reg = &sc->sc_ah->regulatory; | ||
1580 | |||
1581 | return ath_reg_notifier_apply(wiphy, request, reg); | ||
1582 | } | ||
1583 | |||
1584 | void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | 1585 | void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) |
1585 | { | 1586 | { |
1586 | hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | | 1587 | hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | |
@@ -1600,9 +1601,6 @@ void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
1600 | BIT(NL80211_IFTYPE_ADHOC) | | 1601 | BIT(NL80211_IFTYPE_ADHOC) | |
1601 | BIT(NL80211_IFTYPE_MESH_POINT); | 1602 | BIT(NL80211_IFTYPE_MESH_POINT); |
1602 | 1603 | ||
1603 | hw->wiphy->reg_notifier = ath9k_reg_notifier; | ||
1604 | hw->wiphy->strict_regulatory = true; | ||
1605 | |||
1606 | hw->queues = 4; | 1604 | hw->queues = 4; |
1607 | hw->max_rates = 4; | 1605 | hw->max_rates = 4; |
1608 | hw->channel_change_time = 5000; | 1606 | hw->channel_change_time = 5000; |
@@ -1623,7 +1621,6 @@ void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
1623 | int ath_attach(u16 devid, struct ath_softc *sc) | 1621 | int ath_attach(u16 devid, struct ath_softc *sc) |
1624 | { | 1622 | { |
1625 | struct ieee80211_hw *hw = sc->hw; | 1623 | struct ieee80211_hw *hw = sc->hw; |
1626 | const struct ieee80211_regdomain *regd; | ||
1627 | int error = 0, i; | 1624 | int error = 0, i; |
1628 | struct ath_regulatory *reg; | 1625 | struct ath_regulatory *reg; |
1629 | 1626 | ||
@@ -1667,24 +1664,6 @@ int ath_attach(u16 devid, struct ath_softc *sc) | |||
1667 | goto error_attach; | 1664 | goto error_attach; |
1668 | #endif | 1665 | #endif |
1669 | 1666 | ||
1670 | if (ath_is_world_regd(reg)) { | ||
1671 | /* Anything applied here (prior to wiphy registration) gets | ||
1672 | * saved on the wiphy orig_* parameters */ | ||
1673 | regd = ath_world_regdomain(reg); | ||
1674 | hw->wiphy->custom_regulatory = true; | ||
1675 | hw->wiphy->strict_regulatory = false; | ||
1676 | } else { | ||
1677 | /* This gets applied in the case of the absense of CRDA, | ||
1678 | * it's our own custom world regulatory domain, similar to | ||
1679 | * cfg80211's but we enable passive scanning */ | ||
1680 | regd = ath_default_world_regdomain(); | ||
1681 | } | ||
1682 | wiphy_apply_custom_regulatory(hw->wiphy, regd); | ||
1683 | ath_reg_apply_radar_flags(hw->wiphy); | ||
1684 | ath_reg_apply_world_flags(hw->wiphy, | ||
1685 | NL80211_REGDOM_SET_BY_DRIVER, | ||
1686 | reg); | ||
1687 | |||
1688 | INIT_WORK(&sc->chan_work, ath9k_wiphy_chan_work); | 1667 | INIT_WORK(&sc->chan_work, ath9k_wiphy_chan_work); |
1689 | INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work); | 1668 | INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work); |
1690 | sc->wiphy_scheduler_int = msecs_to_jiffies(500); | 1669 | sc->wiphy_scheduler_int = msecs_to_jiffies(500); |