aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-10-06 21:19:08 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-07 16:39:51 -0400
commit7fda16665152851fe65ee73e24afdcaf67acba59 (patch)
treeebc44e24771a45f10473634d3bd4a4e233e63ba8 /drivers/net
parent211f5859af951788a3fe4752142a5e9047afa5d8 (diff)
ath9k: add helper to un-init the hw properly
This is used in several places, ensure we do it right in all callers by using a helper. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 0fe915acd21..e6842dd83ce 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1325,6 +1325,17 @@ void ath_cleanup(struct ath_softc *sc)
1325 ieee80211_free_hw(sc->hw); 1325 ieee80211_free_hw(sc->hw);
1326} 1326}
1327 1327
1328static void ath9k_uninit_hw(struct ath_softc *sc)
1329{
1330 struct ath_hw *ah = sc->sc_ah;
1331
1332 BUG_ON(!ah);
1333
1334 ath9k_exit_debug(ah);
1335 ath9k_hw_detach(ah);
1336 sc->sc_ah = NULL;
1337}
1338
1328void ath_detach(struct ath_softc *sc) 1339void ath_detach(struct ath_softc *sc)
1329{ 1340{
1330 struct ieee80211_hw *hw = sc->hw; 1341 struct ieee80211_hw *hw = sc->hw;
@@ -1365,9 +1376,7 @@ void ath_detach(struct ath_softc *sc)
1365 ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) 1376 ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
1366 ath_gen_timer_free(ah, sc->btcoex.no_stomp_timer); 1377 ath_gen_timer_free(ah, sc->btcoex.no_stomp_timer);
1367 1378
1368 ath9k_exit_debug(ah); 1379 ath9k_uninit_hw(sc);
1369 ath9k_hw_detach(ah);
1370 sc->sc_ah = NULL;
1371} 1380}
1372 1381
1373static int ath9k_reg_notifier(struct wiphy *wiphy, 1382static int ath9k_reg_notifier(struct wiphy *wiphy,
@@ -1850,10 +1859,8 @@ bad2:
1850 if (ATH_TXQ_SETUP(sc, i)) 1859 if (ATH_TXQ_SETUP(sc, i))
1851 ath_tx_cleanupq(sc, &sc->tx.txq[i]); 1860 ath_tx_cleanupq(sc, &sc->tx.txq[i]);
1852 1861
1853 ath9k_exit_debug(ah);
1854bad_free_hw: 1862bad_free_hw:
1855 ath9k_hw_detach(ah); 1863 ath9k_uninit_hw(sc);
1856 sc->sc_ah = NULL;
1857 return r; 1864 return r;
1858} 1865}
1859 1866
@@ -1966,9 +1973,7 @@ error_attach:
1966 if (ATH_TXQ_SETUP(sc, i)) 1973 if (ATH_TXQ_SETUP(sc, i))
1967 ath_tx_cleanupq(sc, &sc->tx.txq[i]); 1974 ath_tx_cleanupq(sc, &sc->tx.txq[i]);
1968 1975
1969 ath9k_exit_debug(ah); 1976 ath9k_uninit_hw(sc);
1970 ath9k_hw_detach(ah);
1971 sc->sc_ah = NULL;
1972 1977
1973 return error; 1978 return error;
1974} 1979}