1 From 72542311c85de25b6f612e8de8cfdeb96efe7308 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Mon, 5 Jan 2009 10:59:29 +0100
4 Subject: [PATCH v3 04/11] ath9k: introduce bus specific cleanup routine
6 We have left only some PCI specific cleanup code. We have to convert
9 Changes-licensed-under: ISC
11 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
12 Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
14 drivers/net/wireless/ath9k/core.h | 7 +++++++
15 drivers/net/wireless/ath9k/main.c | 37 +++++++++++++++++++++++--------------
16 2 files changed, 30 insertions(+), 14 deletions(-)
18 --- a/drivers/net/wireless/ath9k/core.h
19 +++ b/drivers/net/wireless/ath9k/core.h
20 @@ -695,6 +695,7 @@ enum PROT_MODE {
23 void (*read_cachesize)(struct ath_softc *sc, int *csz);
24 + void (*cleanup)(struct ath_softc *sc);
28 @@ -704,6 +705,7 @@ struct ath_softc {
29 struct tasklet_struct bcon_tasklet;
30 struct ath_hal *sc_ah;
33 spinlock_t sc_resetlock;
36 @@ -760,4 +762,9 @@ static inline void ath_read_cachesize(st
37 sc->bus_ops->read_cachesize(sc, csz);
40 +static inline void ath_bus_cleanup(struct ath_softc *sc)
42 + sc->bus_ops->cleanup(sc);
46 --- a/drivers/net/wireless/ath9k/main.c
47 +++ b/drivers/net/wireless/ath9k/main.c
48 @@ -39,6 +39,7 @@ static struct pci_device_id ath_pci_id_t
51 static void ath_detach(struct ath_softc *sc);
52 +static void ath_cleanup(struct ath_softc *sc);
54 /* return bus cachesize in 4B word units */
56 @@ -1269,13 +1270,7 @@ static int ath_start_rfkill_poll(struct
57 rfkill_free(sc->rf_kill.rfkill);
59 /* Deinitialize the device */
61 - if (to_pci_dev(sc->dev)->irq)
62 - free_irq(to_pci_dev(sc->dev)->irq, sc);
63 - pci_iounmap(to_pci_dev(sc->dev), sc->mem);
64 - pci_release_region(to_pci_dev(sc->dev), 0);
65 - pci_disable_device(to_pci_dev(sc->dev));
66 - ieee80211_free_hw(sc->hw);
70 sc->sc_flags |= SC_OP_RFKILL_REGISTERED;
71 @@ -1286,6 +1281,14 @@ static int ath_start_rfkill_poll(struct
73 #endif /* CONFIG_RFKILL */
75 +static void ath_cleanup(struct ath_softc *sc)
78 + free_irq(sc->irq, sc);
79 + ath_bus_cleanup(sc);
80 + ieee80211_free_hw(sc->hw);
83 static void ath_detach(struct ath_softc *sc)
85 struct ieee80211_hw *hw = sc->hw;
86 @@ -2538,8 +2541,18 @@ ath_rf_name(u16 rf_version)
90 +static void ath_pci_cleanup(struct ath_softc *sc)
92 + struct pci_dev *pdev = to_pci_dev(sc->dev);
94 + pci_iounmap(pdev, sc->mem);
95 + pci_release_region(pdev, 0);
96 + pci_disable_device(pdev);
99 static struct ath_bus_ops ath_pci_bus_ops = {
100 .read_cachesize = ath_pci_read_cachesize,
101 + .cleanup = ath_pci_cleanup,
104 static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
105 @@ -2646,6 +2659,8 @@ static int ath_pci_probe(struct pci_dev
109 + sc->irq = pdev->irq;
113 "%s: Atheros AR%s MAC/BB Rev:%x "
114 @@ -2676,13 +2691,7 @@ static void ath_pci_remove(struct pci_de
115 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
116 struct ath_softc *sc = hw->priv;
120 - free_irq(pdev->irq, sc);
121 - pci_iounmap(pdev, sc->mem);
122 - pci_release_region(pdev, 0);
123 - pci_disable_device(pdev);
124 - ieee80211_free_hw(hw);