Commit 8df5d1b7 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville

ath9k: move devid cache setting to ath_init()

This lets us trim one argument off of hw initializer routines.
Signed-off-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 4f3acf81
...@@ -437,16 +437,14 @@ static void ath9k_hw_set_defaults(struct ath_hw *ah) ...@@ -437,16 +437,14 @@ static void ath9k_hw_set_defaults(struct ath_hw *ah)
ah->config.serialize_regmode = SER_REG_MODE_AUTO; ah->config.serialize_regmode = SER_REG_MODE_AUTO;
} }
static void ath9k_hw_newstate(u16 devid, static void ath9k_hw_newstate(struct ath_hw *ah)
struct ath_hw *ah)
{ {
ah->hw_version.magic = AR5416_MAGIC; ah->hw_version.magic = AR5416_MAGIC;
ah->regulatory.country_code = CTRY_DEFAULT; ah->regulatory.country_code = CTRY_DEFAULT;
ah->hw_version.devid = devid;
ah->hw_version.subvendorid = 0; ah->hw_version.subvendorid = 0;
ah->ah_flags = 0; ah->ah_flags = 0;
if ((devid == AR5416_AR9100_DEVID)) if (ah->hw_version.devid == AR5416_AR9100_DEVID)
ah->hw_version.macVersion = AR_SREV_VERSION_9100; ah->hw_version.macVersion = AR_SREV_VERSION_9100;
if (!AR_SREV_9100(ah)) if (!AR_SREV_9100(ah))
ah->ah_flags = AH_USE_EEPROM; ah->ah_flags = AH_USE_EEPROM;
...@@ -611,13 +609,12 @@ static int ath9k_hw_post_attach(struct ath_hw *ah) ...@@ -611,13 +609,12 @@ static int ath9k_hw_post_attach(struct ath_hw *ah)
} }
static int ath9k_hw_do_attach(struct ath_hw *ah, static int ath9k_hw_do_attach(struct ath_hw *ah,
u16 devid,
struct ath_softc *sc) struct ath_softc *sc)
{ {
int r; int r;
u32 i, j; u32 i, j;
ath9k_hw_newstate(devid, ah); ath9k_hw_newstate(ah);
ath9k_hw_set_defaults(ah); ath9k_hw_set_defaults(ah);
if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) { if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) {
...@@ -1186,9 +1183,9 @@ void ath9k_hw_detach(struct ath_hw *ah) ...@@ -1186,9 +1183,9 @@ void ath9k_hw_detach(struct ath_hw *ah)
kfree(ah); kfree(ah);
} }
int ath9k_hw_attach(struct ath_hw *ah, u16 devid, struct ath_softc *sc) int ath9k_hw_attach(struct ath_hw *ah, struct ath_softc *sc)
{ {
switch (devid) { switch (ah->hw_version.devid) {
case AR5416_DEVID_PCI: case AR5416_DEVID_PCI:
case AR5416_DEVID_PCIE: case AR5416_DEVID_PCIE:
case AR5416_AR9100_DEVID: case AR5416_AR9100_DEVID:
...@@ -1198,7 +1195,7 @@ int ath9k_hw_attach(struct ath_hw *ah, u16 devid, struct ath_softc *sc) ...@@ -1198,7 +1195,7 @@ int ath9k_hw_attach(struct ath_hw *ah, u16 devid, struct ath_softc *sc)
case AR9285_DEVID_PCIE: case AR9285_DEVID_PCIE:
case AR5416_DEVID_AR9287_PCI: case AR5416_DEVID_AR9287_PCI:
case AR5416_DEVID_AR9287_PCIE: case AR5416_DEVID_AR9287_PCIE:
return ath9k_hw_do_attach(ah, devid, sc); return ath9k_hw_do_attach(ah, sc);
default: default:
break; break;
} }
......
...@@ -544,7 +544,7 @@ struct ath_hw { ...@@ -544,7 +544,7 @@ struct ath_hw {
/* Attach, Detach, Reset */ /* Attach, Detach, Reset */
const char *ath9k_hw_probe(u16 vendorid, u16 devid); const char *ath9k_hw_probe(u16 vendorid, u16 devid);
void ath9k_hw_detach(struct ath_hw *ah); void ath9k_hw_detach(struct ath_hw *ah);
int ath9k_hw_attach(struct ath_hw *ah, u16 devid, struct ath_softc *sc); int ath9k_hw_attach(struct ath_hw *ah, struct ath_softc *sc);
void ath9k_hw_rfdetach(struct ath_hw *ah); void ath9k_hw_rfdetach(struct ath_hw *ah);
int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
bool bChannelChange); bool bChannelChange);
......
...@@ -1331,8 +1331,9 @@ static int ath_init(u16 devid, struct ath_softc *sc) ...@@ -1331,8 +1331,9 @@ static int ath_init(u16 devid, struct ath_softc *sc)
} }
ah->ah_sc = sc; ah->ah_sc = sc;
ah->hw_version.devid = devid;
r = ath9k_hw_attach(ah, devid, sc); r = ath9k_hw_attach(ah, sc);
if (r) { if (r) {
DPRINTF(sc, ATH_DBG_FATAL, DPRINTF(sc, ATH_DBG_FATAL,
"Unable to attach hardware; " "Unable to attach hardware; "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment