aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2009-03-30 22:30:31 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:37 -0400
commitf769c36bd71ebe8d7a5f83764f0428d36ebced35 (patch)
tree8aad786a4442e997f778d6fca9944d372f40faa5
parente3bb249be89dd387e78ca382d08fad31745edac9 (diff)
ath5k: use regulatory infrastructure
Make ath5k select the ath module and add in the hooks to make the eeprom regulatory hint and reg notifier take effect. Changes to attach.c Changes-licensed-under: ISC Changes to base.c Changes-licensed-under: 3-Clause-BSD Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath5k/Kconfig1
-rw-r--r--drivers/net/wireless/ath5k/ath5k.h5
-rw-r--r--drivers/net/wireless/ath5k/base.c20
3 files changed, 24 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath5k/Kconfig b/drivers/net/wireless/ath5k/Kconfig
index 75383a5df992..509b6f94f73b 100644
--- a/drivers/net/wireless/ath5k/Kconfig
+++ b/drivers/net/wireless/ath5k/Kconfig
@@ -1,6 +1,7 @@
1config ATH5K 1config ATH5K
2 tristate "Atheros 5xxx wireless cards support" 2 tristate "Atheros 5xxx wireless cards support"
3 depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL 3 depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
4 select ATH_COMMON
4 select MAC80211_LEDS 5 select MAC80211_LEDS
5 select LEDS_CLASS 6 select LEDS_CLASS
6 select NEW_LEDS 7 select NEW_LEDS
diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h
index 0b616e72fe05..48c18d11c507 100644
--- a/drivers/net/wireless/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath5k/ath5k.h
@@ -27,6 +27,8 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <net/mac80211.h> 28#include <net/mac80211.h>
29 29
30#include "../ath/regd.h"
31
30/* RX/TX descriptor hw structs 32/* RX/TX descriptor hw structs
31 * TODO: Driver part should only see sw structs */ 33 * TODO: Driver part should only see sw structs */
32#include "desc.h" 34#include "desc.h"
@@ -1039,8 +1041,6 @@ struct ath5k_hw {
1039 bool ah_5ghz; 1041 bool ah_5ghz;
1040 bool ah_2ghz; 1042 bool ah_2ghz;
1041 1043
1042#define ah_regdomain ah_capabilities.cap_regdomain.reg_current
1043#define ah_regdomain_hw ah_capabilities.cap_regdomain.reg_hw
1044#define ah_modes ah_capabilities.cap_mode 1044#define ah_modes ah_capabilities.cap_mode
1045#define ah_ee_version ah_capabilities.cap_eeprom.ee_version 1045#define ah_ee_version ah_capabilities.cap_eeprom.ee_version
1046 1046
@@ -1065,6 +1065,7 @@ struct ath5k_hw {
1065 u32 ah_gpio[AR5K_MAX_GPIO]; 1065 u32 ah_gpio[AR5K_MAX_GPIO];
1066 int ah_gpio_npins; 1066 int ah_gpio_npins;
1067 1067
1068 struct ath_regulatory ah_regulatory;
1068 struct ath5k_capabilities ah_capabilities; 1069 struct ath5k_capabilities ah_capabilities;
1069 1070
1070 struct ath5k_txq_info ah_txq[AR5K_NUM_TX_QUEUES]; 1071 struct ath5k_txq_info ah_txq[AR5K_NUM_TX_QUEUES];
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index d8c60c53d953..ff6d4f839734 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -709,6 +709,15 @@ err_no_irq:
709* Driver Initialization * 709* Driver Initialization *
710\***********************/ 710\***********************/
711 711
712static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
713{
714 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
715 struct ath5k_softc *sc = hw->priv;
716 struct ath_regulatory *reg = &sc->ah->ah_regulatory;
717
718 return ath_reg_notifier_apply(wiphy, request, reg);
719}
720
712static int 721static int
713ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) 722ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
714{ 723{
@@ -797,12 +806,23 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
797 memset(sc->bssidmask, 0xff, ETH_ALEN); 806 memset(sc->bssidmask, 0xff, ETH_ALEN);
798 ath5k_hw_set_bssid_mask(sc->ah, sc->bssidmask); 807 ath5k_hw_set_bssid_mask(sc->ah, sc->bssidmask);
799 808
809 ah->ah_regulatory.current_rd =
810 ah->ah_capabilities.cap_eeprom.ee_regdomain;
811 ret = ath_regd_init(&ah->ah_regulatory, hw->wiphy, ath5k_reg_notifier);
812 if (ret) {
813 ATH5K_ERR(sc, "can't initialize regulatory system\n");
814 goto err_queues;
815 }
816
800 ret = ieee80211_register_hw(hw); 817 ret = ieee80211_register_hw(hw);
801 if (ret) { 818 if (ret) {
802 ATH5K_ERR(sc, "can't register ieee80211 hw\n"); 819 ATH5K_ERR(sc, "can't register ieee80211 hw\n");
803 goto err_queues; 820 goto err_queues;
804 } 821 }
805 822
823 if (!ath_is_world_regd(&sc->ah->ah_regulatory))
824 regulatory_hint(hw->wiphy, sc->ah->ah_regulatory.alpha2);
825
806 ath5k_init_leds(sc); 826 ath5k_init_leds(sc);
807 827
808 return 0; 828 return 0;