aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/hw.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-08-03 15:24:39 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-04 16:44:28 -0400
commitee2bb460e28b757f097efb9e5947a6e47e2477e1 (patch)
treef1766258501d18f7064f7a85e544338e23db093c /drivers/net/wireless/ath/ath9k/hw.c
parente1e2f93ffacab692823209e00a124e802039aa9a (diff)
ath9k: call hw initializer directly
ath9k_hw_attach() was going first through some device id verifier, and then calling some other helper which was doing the real hardware initialization. Lets just do the devid checks within the real worker by calling a helper ath9k_hw_devid_supported(). 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/ath9k/hw.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index ff2875b233da..d8ae289a09b4 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -608,12 +608,35 @@ static int ath9k_hw_post_attach(struct ath_hw *ah)
608 return 0; 608 return 0;
609} 609}
610 610
611static int ath9k_hw_do_attach(struct ath_hw *ah, 611static bool ath9k_hw_devid_supported(u16 devid)
612 struct ath_softc *sc) 612{
613 switch (devid) {
614 case AR5416_DEVID_PCI:
615 case AR5416_DEVID_PCIE:
616 case AR5416_AR9100_DEVID:
617 case AR9160_DEVID_PCI:
618 case AR9280_DEVID_PCI:
619 case AR9280_DEVID_PCIE:
620 case AR9285_DEVID_PCIE:
621 case AR5416_DEVID_AR9287_PCI:
622 case AR5416_DEVID_AR9287_PCIE:
623 return true;
624 default:
625 break;
626 }
627 return false;
628}
629
630int ath9k_hw_attach(struct ath_hw *ah, struct ath_softc *sc)
613{ 631{
614 int r; 632 int r;
615 u32 i, j; 633 u32 i, j;
616 634
635 if (!ath9k_hw_devid_supported(ah->hw_version.devid)) {
636 r = -EOPNOTSUPP;
637 goto bad;
638 }
639
617 ath9k_hw_newstate(ah); 640 ath9k_hw_newstate(ah);
618 ath9k_hw_set_defaults(ah); 641 ath9k_hw_set_defaults(ah);
619 642
@@ -1183,25 +1206,6 @@ void ath9k_hw_detach(struct ath_hw *ah)
1183 kfree(ah); 1206 kfree(ah);
1184} 1207}
1185 1208
1186int ath9k_hw_attach(struct ath_hw *ah, struct ath_softc *sc)
1187{
1188 switch (ah->hw_version.devid) {
1189 case AR5416_DEVID_PCI:
1190 case AR5416_DEVID_PCIE:
1191 case AR5416_AR9100_DEVID:
1192 case AR9160_DEVID_PCI:
1193 case AR9280_DEVID_PCI:
1194 case AR9280_DEVID_PCIE:
1195 case AR9285_DEVID_PCIE:
1196 case AR5416_DEVID_AR9287_PCI:
1197 case AR5416_DEVID_AR9287_PCIE:
1198 return ath9k_hw_do_attach(ah, sc);
1199 default:
1200 break;
1201 }
1202 return -EOPNOTSUPP;
1203}
1204
1205/*******/ 1209/*******/
1206/* INI */ 1210/* INI */
1207/*******/ 1211/*******/
@@ -2898,7 +2902,7 @@ void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore)
2898 /* 2902 /*
2899 * AR9280 2.0 or later chips use SerDes values from the 2903 * AR9280 2.0 or later chips use SerDes values from the
2900 * initvals.h initialized depending on chipset during 2904 * initvals.h initialized depending on chipset during
2901 * ath9k_hw_do_attach() 2905 * ath9k_hw_attach()
2902 */ 2906 */
2903 for (i = 0; i < ah->iniPcieSerdes.ia_rows; i++) { 2907 for (i = 0; i < ah->iniPcieSerdes.ia_rows; i++) {
2904 REG_WRITE(ah, INI_RA(&ah->iniPcieSerdes, i, 0), 2908 REG_WRITE(ah, INI_RA(&ah->iniPcieSerdes, i, 0),