diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-08-17 21:07:23 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-20 11:36:03 -0400 |
commit | 608b88cb34b0e70a538ee1fc334cc833ef691836 (patch) | |
tree | 6d2a363cea722241581306964da6cff8724b407a /drivers/net/wireless/ath/ath5k | |
parent | 4c48381786159ba3f3d8a33d967aeb049341a220 (diff) |
ath: move regulatory info into shared common structure
This moves the shared regulatory structure into the
common structure. We will use this ongoing for common
data.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/ath5k.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.h | 13 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/phy.c | 3 |
4 files changed, 22 insertions, 11 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h index c09402eea7f3..862762cea54c 100644 --- a/drivers/net/wireless/ath/ath5k/ath5k.h +++ b/drivers/net/wireless/ath/ath5k/ath5k.h | |||
@@ -27,8 +27,6 @@ | |||
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <net/mac80211.h> | 28 | #include <net/mac80211.h> |
29 | 29 | ||
30 | #include "../regd.h" | ||
31 | |||
32 | /* RX/TX descriptor hw structs | 30 | /* RX/TX descriptor hw structs |
33 | * TODO: Driver part should only see sw structs */ | 31 | * TODO: Driver part should only see sw structs */ |
34 | #include "desc.h" | 32 | #include "desc.h" |
@@ -1077,7 +1075,6 @@ struct ath5k_hw { | |||
1077 | 1075 | ||
1078 | int ah_gpio_npins; | 1076 | int ah_gpio_npins; |
1079 | 1077 | ||
1080 | struct ath_regulatory ah_regulatory; | ||
1081 | struct ath5k_capabilities ah_capabilities; | 1078 | struct ath5k_capabilities ah_capabilities; |
1082 | 1079 | ||
1083 | struct ath5k_txq_info ah_txq[AR5K_NUM_TX_QUEUES]; | 1080 | struct ath5k_txq_info ah_txq[AR5K_NUM_TX_QUEUES]; |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 3951b5b13424..5056410d788a 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -718,9 +718,9 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re | |||
718 | { | 718 | { |
719 | struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); | 719 | struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
720 | struct ath5k_softc *sc = hw->priv; | 720 | struct ath5k_softc *sc = hw->priv; |
721 | struct ath_regulatory *reg = &sc->ah->ah_regulatory; | 721 | struct ath_regulatory *regulatory = &sc->common.regulatory; |
722 | 722 | ||
723 | return ath_reg_notifier_apply(wiphy, request, reg); | 723 | return ath_reg_notifier_apply(wiphy, request, regulatory); |
724 | } | 724 | } |
725 | 725 | ||
726 | static int | 726 | static int |
@@ -728,6 +728,7 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) | |||
728 | { | 728 | { |
729 | struct ath5k_softc *sc = hw->priv; | 729 | struct ath5k_softc *sc = hw->priv; |
730 | struct ath5k_hw *ah = sc->ah; | 730 | struct ath5k_hw *ah = sc->ah; |
731 | struct ath_regulatory *regulatory = &sc->common.regulatory; | ||
731 | u8 mac[ETH_ALEN] = {}; | 732 | u8 mac[ETH_ALEN] = {}; |
732 | int ret; | 733 | int ret; |
733 | 734 | ||
@@ -817,9 +818,8 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) | |||
817 | memset(sc->bssidmask, 0xff, ETH_ALEN); | 818 | memset(sc->bssidmask, 0xff, ETH_ALEN); |
818 | ath5k_hw_set_bssid_mask(sc->ah, sc->bssidmask); | 819 | ath5k_hw_set_bssid_mask(sc->ah, sc->bssidmask); |
819 | 820 | ||
820 | ah->ah_regulatory.current_rd = | 821 | regulatory->current_rd = ah->ah_capabilities.cap_eeprom.ee_regdomain; |
821 | ah->ah_capabilities.cap_eeprom.ee_regdomain; | 822 | ret = ath_regd_init(regulatory, hw->wiphy, ath5k_reg_notifier); |
822 | ret = ath_regd_init(&ah->ah_regulatory, hw->wiphy, ath5k_reg_notifier); | ||
823 | if (ret) { | 823 | if (ret) { |
824 | ATH5K_ERR(sc, "can't initialize regulatory system\n"); | 824 | ATH5K_ERR(sc, "can't initialize regulatory system\n"); |
825 | goto err_queues; | 825 | goto err_queues; |
@@ -831,8 +831,8 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) | |||
831 | goto err_queues; | 831 | goto err_queues; |
832 | } | 832 | } |
833 | 833 | ||
834 | if (!ath_is_world_regd(&sc->ah->ah_regulatory)) | 834 | if (!ath_is_world_regd(regulatory)) |
835 | regulatory_hint(hw->wiphy, sc->ah->ah_regulatory.alpha2); | 835 | regulatory_hint(hw->wiphy, regulatory->alpha2); |
836 | 836 | ||
837 | ath5k_init_leds(sc); | 837 | ath5k_init_leds(sc); |
838 | 838 | ||
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h index 25a72a85aaa5..a28c42f32c9d 100644 --- a/drivers/net/wireless/ath/ath5k/base.h +++ b/drivers/net/wireless/ath/ath5k/base.h | |||
@@ -50,6 +50,8 @@ | |||
50 | 50 | ||
51 | #include "ath5k.h" | 51 | #include "ath5k.h" |
52 | #include "debug.h" | 52 | #include "debug.h" |
53 | |||
54 | #include "../regd.h" | ||
53 | #include "../ath.h" | 55 | #include "../ath.h" |
54 | 56 | ||
55 | #define ATH_RXBUF 40 /* number of RX buffers */ | 57 | #define ATH_RXBUF 40 /* number of RX buffers */ |
@@ -200,4 +202,15 @@ struct ath5k_softc { | |||
200 | #define ath5k_hw_hasveol(_ah) \ | 202 | #define ath5k_hw_hasveol(_ah) \ |
201 | (ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0) | 203 | (ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0) |
202 | 204 | ||
205 | static inline struct ath_common *ath5k_hw_common(struct ath5k_hw *ah) | ||
206 | { | ||
207 | return &ah->ah_sc->common; | ||
208 | } | ||
209 | |||
210 | static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah) | ||
211 | { | ||
212 | return &(ath5k_hw_common(ah)->regulatory); | ||
213 | |||
214 | } | ||
215 | |||
203 | #endif | 216 | #endif |
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index 298fcf015227..1a039f2bd732 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c | |||
@@ -2198,6 +2198,7 @@ static void | |||
2198 | ath5k_get_max_ctl_power(struct ath5k_hw *ah, | 2198 | ath5k_get_max_ctl_power(struct ath5k_hw *ah, |
2199 | struct ieee80211_channel *channel) | 2199 | struct ieee80211_channel *channel) |
2200 | { | 2200 | { |
2201 | struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah); | ||
2201 | struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; | 2202 | struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; |
2202 | struct ath5k_edge_power *rep = ee->ee_ctl_pwr; | 2203 | struct ath5k_edge_power *rep = ee->ee_ctl_pwr; |
2203 | u8 *ctl_val = ee->ee_ctl; | 2204 | u8 *ctl_val = ee->ee_ctl; |
@@ -2208,7 +2209,7 @@ ath5k_get_max_ctl_power(struct ath5k_hw *ah, | |||
2208 | u8 ctl_idx = 0xFF; | 2209 | u8 ctl_idx = 0xFF; |
2209 | u32 target = channel->center_freq; | 2210 | u32 target = channel->center_freq; |
2210 | 2211 | ||
2211 | ctl_mode = ath_regd_get_band_ctl(&ah->ah_regulatory, channel->band); | 2212 | ctl_mode = ath_regd_get_band_ctl(regulatory, channel->band); |
2212 | 2213 | ||
2213 | switch (channel->hw_value & CHANNEL_MODES) { | 2214 | switch (channel->hw_value & CHANNEL_MODES) { |
2214 | case CHANNEL_A: | 2215 | case CHANNEL_A: |