diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2009-01-14 14:17:05 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 16:00:30 -0500 |
commit | 39c3c2f2de6bccf698bfb5b9c4f56ddf99de0dbc (patch) | |
tree | 7ca6a1066ba36a318e47d6899c925109e3f8a08d /drivers | |
parent | 88d15707644fad1a137af7a17b00da6135f1c1a8 (diff) |
ath9k: introduce bus specific cleanup routine
We have left only some PCI specific cleanup code. We have to convert
them as well.
Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
Tested-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath9k/core.h | 7 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 37 |
2 files changed, 30 insertions, 14 deletions
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h index 8e93d11d57af..f9fa5c64c77b 100644 --- a/drivers/net/wireless/ath9k/core.h +++ b/drivers/net/wireless/ath9k/core.h | |||
@@ -695,6 +695,7 @@ enum PROT_MODE { | |||
695 | 695 | ||
696 | struct ath_bus_ops { | 696 | struct ath_bus_ops { |
697 | void (*read_cachesize)(struct ath_softc *sc, int *csz); | 697 | void (*read_cachesize)(struct ath_softc *sc, int *csz); |
698 | void (*cleanup)(struct ath_softc *sc); | ||
698 | }; | 699 | }; |
699 | 700 | ||
700 | struct ath_softc { | 701 | struct ath_softc { |
@@ -704,6 +705,7 @@ struct ath_softc { | |||
704 | struct tasklet_struct bcon_tasklet; | 705 | struct tasklet_struct bcon_tasklet; |
705 | struct ath_hal *sc_ah; | 706 | struct ath_hal *sc_ah; |
706 | void __iomem *mem; | 707 | void __iomem *mem; |
708 | int irq; | ||
707 | spinlock_t sc_resetlock; | 709 | spinlock_t sc_resetlock; |
708 | struct mutex mutex; | 710 | struct mutex mutex; |
709 | 711 | ||
@@ -760,4 +762,9 @@ static inline void ath_read_cachesize(struct ath_softc *sc, int *csz) | |||
760 | sc->bus_ops->read_cachesize(sc, csz); | 762 | sc->bus_ops->read_cachesize(sc, csz); |
761 | } | 763 | } |
762 | 764 | ||
765 | static inline void ath_bus_cleanup(struct ath_softc *sc) | ||
766 | { | ||
767 | sc->bus_ops->cleanup(sc); | ||
768 | } | ||
769 | |||
763 | #endif /* CORE_H */ | 770 | #endif /* CORE_H */ |
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 884469a30235..dd2be2644cad 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -39,6 +39,7 @@ static struct pci_device_id ath_pci_id_table[] __devinitdata = { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | static void ath_detach(struct ath_softc *sc); | 41 | static void ath_detach(struct ath_softc *sc); |
42 | static void ath_cleanup(struct ath_softc *sc); | ||
42 | 43 | ||
43 | /* return bus cachesize in 4B word units */ | 44 | /* return bus cachesize in 4B word units */ |
44 | 45 | ||
@@ -1267,13 +1268,7 @@ static int ath_start_rfkill_poll(struct ath_softc *sc) | |||
1267 | rfkill_free(sc->rf_kill.rfkill); | 1268 | rfkill_free(sc->rf_kill.rfkill); |
1268 | 1269 | ||
1269 | /* Deinitialize the device */ | 1270 | /* Deinitialize the device */ |
1270 | ath_detach(sc); | 1271 | ath_cleanup(sc); |
1271 | if (to_pci_dev(sc->dev)->irq) | ||
1272 | free_irq(to_pci_dev(sc->dev)->irq, sc); | ||
1273 | pci_iounmap(to_pci_dev(sc->dev), sc->mem); | ||
1274 | pci_release_region(to_pci_dev(sc->dev), 0); | ||
1275 | pci_disable_device(to_pci_dev(sc->dev)); | ||
1276 | ieee80211_free_hw(sc->hw); | ||
1277 | return -EIO; | 1272 | return -EIO; |
1278 | } else { | 1273 | } else { |
1279 | sc->sc_flags |= SC_OP_RFKILL_REGISTERED; | 1274 | sc->sc_flags |= SC_OP_RFKILL_REGISTERED; |
@@ -1284,6 +1279,14 @@ static int ath_start_rfkill_poll(struct ath_softc *sc) | |||
1284 | } | 1279 | } |
1285 | #endif /* CONFIG_RFKILL */ | 1280 | #endif /* CONFIG_RFKILL */ |
1286 | 1281 | ||
1282 | static void ath_cleanup(struct ath_softc *sc) | ||
1283 | { | ||
1284 | ath_detach(sc); | ||
1285 | free_irq(sc->irq, sc); | ||
1286 | ath_bus_cleanup(sc); | ||
1287 | ieee80211_free_hw(sc->hw); | ||
1288 | } | ||
1289 | |||
1287 | static void ath_detach(struct ath_softc *sc) | 1290 | static void ath_detach(struct ath_softc *sc) |
1288 | { | 1291 | { |
1289 | struct ieee80211_hw *hw = sc->hw; | 1292 | struct ieee80211_hw *hw = sc->hw; |
@@ -2534,8 +2537,18 @@ ath_rf_name(u16 rf_version) | |||
2534 | return "????"; | 2537 | return "????"; |
2535 | } | 2538 | } |
2536 | 2539 | ||
2540 | static void ath_pci_cleanup(struct ath_softc *sc) | ||
2541 | { | ||
2542 | struct pci_dev *pdev = to_pci_dev(sc->dev); | ||
2543 | |||
2544 | pci_iounmap(pdev, sc->mem); | ||
2545 | pci_release_region(pdev, 0); | ||
2546 | pci_disable_device(pdev); | ||
2547 | } | ||
2548 | |||
2537 | static struct ath_bus_ops ath_pci_bus_ops = { | 2549 | static struct ath_bus_ops ath_pci_bus_ops = { |
2538 | .read_cachesize = ath_pci_read_cachesize, | 2550 | .read_cachesize = ath_pci_read_cachesize, |
2551 | .cleanup = ath_pci_cleanup, | ||
2539 | }; | 2552 | }; |
2540 | 2553 | ||
2541 | static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | 2554 | static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
@@ -2642,6 +2655,8 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
2642 | goto bad4; | 2655 | goto bad4; |
2643 | } | 2656 | } |
2644 | 2657 | ||
2658 | sc->irq = pdev->irq; | ||
2659 | |||
2645 | ah = sc->sc_ah; | 2660 | ah = sc->sc_ah; |
2646 | printk(KERN_INFO | 2661 | printk(KERN_INFO |
2647 | "%s: Atheros AR%s MAC/BB Rev:%x " | 2662 | "%s: Atheros AR%s MAC/BB Rev:%x " |
@@ -2672,13 +2687,7 @@ static void ath_pci_remove(struct pci_dev *pdev) | |||
2672 | struct ieee80211_hw *hw = pci_get_drvdata(pdev); | 2687 | struct ieee80211_hw *hw = pci_get_drvdata(pdev); |
2673 | struct ath_softc *sc = hw->priv; | 2688 | struct ath_softc *sc = hw->priv; |
2674 | 2689 | ||
2675 | ath_detach(sc); | 2690 | ath_cleanup(sc); |
2676 | if (pdev->irq) | ||
2677 | free_irq(pdev->irq, sc); | ||
2678 | pci_iounmap(pdev, sc->mem); | ||
2679 | pci_release_region(pdev, 0); | ||
2680 | pci_disable_device(pdev); | ||
2681 | ieee80211_free_hw(hw); | ||
2682 | } | 2691 | } |
2683 | 2692 | ||
2684 | #ifdef CONFIG_PM | 2693 | #ifdef CONFIG_PM |