diff options
author | Bob Copeland <me@bobcopeland.com> | 2009-03-30 22:30:29 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-04-22 16:54:37 -0400 |
commit | 3a702e49c03ba959e3f5bb2b74ec9921a81c8c98 (patch) | |
tree | 721e8a222648284660f5bf6c5edfba5a6e4d4527 /drivers/net/wireless/ath9k/main.c | |
parent | c02cf3738c9dbc446c160b9d49a001eb2be316c8 (diff) |
atheros: introduce ath module containing common ath5k/ath9k/ar9170 code
This change creates a new module, ath.ko, which includes code that can
be shared between ath5k, ath9k and ar9170. For now, extract most of the ath9k
regulatory code so it can also be used in ath5k.
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 | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 3647a47d939d..d779f00c9b9d 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -1406,7 +1406,7 @@ static int ath_init(u16 devid, struct ath_softc *sc) | |||
1406 | for (i = 0; i < sc->keymax; i++) | 1406 | for (i = 0; i < sc->keymax; i++) |
1407 | ath9k_hw_keyreset(ah, (u16) i); | 1407 | ath9k_hw_keyreset(ah, (u16) i); |
1408 | 1408 | ||
1409 | if (ath9k_regd_init(&sc->sc_ah->regulatory)) | 1409 | if (ath_regd_init(&sc->sc_ah->regulatory)) |
1410 | goto bad; | 1410 | goto bad; |
1411 | 1411 | ||
1412 | /* default to MONITOR mode */ | 1412 | /* default to MONITOR mode */ |
@@ -1570,6 +1570,17 @@ bad: | |||
1570 | return error; | 1570 | return error; |
1571 | } | 1571 | } |
1572 | 1572 | ||
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 | |||
1573 | void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | 1584 | void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) |
1574 | { | 1585 | { |
1575 | hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | | 1586 | hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | |
@@ -1614,7 +1625,7 @@ int ath_attach(u16 devid, struct ath_softc *sc) | |||
1614 | struct ieee80211_hw *hw = sc->hw; | 1625 | struct ieee80211_hw *hw = sc->hw; |
1615 | const struct ieee80211_regdomain *regd; | 1626 | const struct ieee80211_regdomain *regd; |
1616 | int error = 0, i; | 1627 | int error = 0, i; |
1617 | struct ath9k_regulatory *reg; | 1628 | struct ath_regulatory *reg; |
1618 | 1629 | ||
1619 | DPRINTF(sc, ATH_DBG_CONFIG, "Attach ATH hw\n"); | 1630 | DPRINTF(sc, ATH_DBG_CONFIG, "Attach ATH hw\n"); |
1620 | 1631 | ||
@@ -1656,23 +1667,23 @@ int ath_attach(u16 devid, struct ath_softc *sc) | |||
1656 | goto error_attach; | 1667 | goto error_attach; |
1657 | #endif | 1668 | #endif |
1658 | 1669 | ||
1659 | if (ath9k_is_world_regd(reg)) { | 1670 | if (ath_is_world_regd(reg)) { |
1660 | /* Anything applied here (prior to wiphy registration) gets | 1671 | /* Anything applied here (prior to wiphy registration) gets |
1661 | * saved on the wiphy orig_* parameters */ | 1672 | * saved on the wiphy orig_* parameters */ |
1662 | regd = ath9k_world_regdomain(reg); | 1673 | regd = ath_world_regdomain(reg); |
1663 | hw->wiphy->custom_regulatory = true; | 1674 | hw->wiphy->custom_regulatory = true; |
1664 | hw->wiphy->strict_regulatory = false; | 1675 | hw->wiphy->strict_regulatory = false; |
1665 | } else { | 1676 | } else { |
1666 | /* This gets applied in the case of the absense of CRDA, | 1677 | /* This gets applied in the case of the absense of CRDA, |
1667 | * it's our own custom world regulatory domain, similar to | 1678 | * it's our own custom world regulatory domain, similar to |
1668 | * cfg80211's but we enable passive scanning */ | 1679 | * cfg80211's but we enable passive scanning */ |
1669 | regd = ath9k_default_world_regdomain(); | 1680 | regd = ath_default_world_regdomain(); |
1670 | } | 1681 | } |
1671 | wiphy_apply_custom_regulatory(hw->wiphy, regd); | 1682 | wiphy_apply_custom_regulatory(hw->wiphy, regd); |
1672 | ath9k_reg_apply_radar_flags(hw->wiphy); | 1683 | ath_reg_apply_radar_flags(hw->wiphy); |
1673 | ath9k_reg_apply_world_flags(hw->wiphy, | 1684 | ath_reg_apply_world_flags(hw->wiphy, |
1674 | NL80211_REGDOM_SET_BY_DRIVER, | 1685 | NL80211_REGDOM_SET_BY_DRIVER, |
1675 | reg); | 1686 | reg); |
1676 | 1687 | ||
1677 | INIT_WORK(&sc->chan_work, ath9k_wiphy_chan_work); | 1688 | INIT_WORK(&sc->chan_work, ath9k_wiphy_chan_work); |
1678 | INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work); | 1689 | INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work); |
@@ -1680,7 +1691,7 @@ int ath_attach(u16 devid, struct ath_softc *sc) | |||
1680 | 1691 | ||
1681 | error = ieee80211_register_hw(hw); | 1692 | error = ieee80211_register_hw(hw); |
1682 | 1693 | ||
1683 | if (!ath9k_is_world_regd(reg)) { | 1694 | if (!ath_is_world_regd(reg)) { |
1684 | error = regulatory_hint(hw->wiphy, reg->alpha2); | 1695 | error = regulatory_hint(hw->wiphy, reg->alpha2); |
1685 | if (error) | 1696 | if (error) |
1686 | goto error_attach; | 1697 | goto error_attach; |