1 From 7524b77fe24a4464b08a2ac987ec22711a4f2027 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 v2 04/11] ath9k: introduce bus specific cleanup routine
6 We have left only some PCI specific cleanup code. We have to convert
9 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
10 Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
12 drivers/net/wireless/ath9k/core.h | 7 +++++++
13 drivers/net/wireless/ath9k/main.c | 37 +++++++++++++++++++++++--------------
14 2 files changed, 30 insertions(+), 14 deletions(-)
16 --- a/drivers/net/wireless/ath9k/core.h
17 +++ b/drivers/net/wireless/ath9k/core.h
18 @@ -695,6 +695,7 @@ enum PROT_MODE {
21 void (*read_cachesize)(struct ath_softc *sc, int *csz);
22 + void (*cleanup)(struct ath_softc *sc);
26 @@ -704,6 +705,7 @@ struct ath_softc {
27 struct tasklet_struct bcon_tasklet;
28 struct ath_hal *sc_ah;
31 spinlock_t sc_resetlock;
34 @@ -760,4 +762,9 @@ static inline void ath_read_cachesize(st
35 sc->bus_ops->read_cachesize(sc, csz);
38 +static inline void ath_bus_cleanup(struct ath_softc *sc)
40 + sc->bus_ops->cleanup(sc);
44 --- a/drivers/net/wireless/ath9k/main.c
45 +++ b/drivers/net/wireless/ath9k/main.c
46 @@ -39,6 +39,7 @@ static struct pci_device_id ath_pci_id_t
49 static void ath_detach(struct ath_softc *sc);
50 +static void ath_cleanup(struct ath_softc *sc);
52 /* return bus cachesize in 4B word units */
54 @@ -1267,13 +1268,7 @@ static int ath_start_rfkill_poll(struct
55 rfkill_free(sc->rf_kill.rfkill);
57 /* Deinitialize the device */
59 - if (to_pci_dev(sc->dev)->irq)
60 - free_irq(to_pci_dev(sc->dev)->irq, sc);
61 - pci_iounmap(to_pci_dev(sc->dev), sc->mem);
62 - pci_release_region(to_pci_dev(sc->dev), 0);
63 - pci_disable_device(to_pci_dev(sc->dev));
64 - ieee80211_free_hw(sc->hw);
68 sc->sc_flags |= SC_OP_RFKILL_REGISTERED;
69 @@ -1284,6 +1279,14 @@ static int ath_start_rfkill_poll(struct
71 #endif /* CONFIG_RFKILL */
73 +static void ath_cleanup(struct ath_softc *sc)
76 + free_irq(sc->irq, sc);
77 + ath_bus_cleanup(sc);
78 + ieee80211_free_hw(sc->hw);
81 static void ath_detach(struct ath_softc *sc)
83 struct ieee80211_hw *hw = sc->hw;
84 @@ -2529,8 +2532,18 @@ ath_rf_name(u16 rf_version)
88 +static void ath_pci_cleanup(struct ath_softc *sc)
90 + struct pci_dev *pdev = to_pci_dev(sc->dev);
92 + pci_iounmap(pdev, sc->mem);
93 + pci_release_region(pdev, 0);
94 + pci_disable_device(pdev);
97 static struct ath_bus_ops ath_pci_bus_ops = {
98 .read_cachesize = ath_pci_read_cachesize,
99 + .cleanup = ath_pci_cleanup,
102 static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
103 @@ -2637,6 +2650,8 @@ static int ath_pci_probe(struct pci_dev
107 + sc->irq = pdev->irq;
111 "%s: Atheros AR%s MAC/BB Rev:%x "
112 @@ -2667,13 +2682,7 @@ static void ath_pci_remove(struct pci_de
113 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
114 struct ath_softc *sc = hw->priv;
118 - free_irq(pdev->irq, sc);
119 - pci_iounmap(pdev, sc->mem);
120 - pci_release_region(pdev, 0);
121 - pci_disable_device(pdev);
122 - ieee80211_free_hw(hw);