-From d23e90c384edfbf039cb8b8d94c0ef90022949e7 Mon Sep 17 00:00:00 2001
+From 72542311c85de25b6f612e8de8cfdeb96efe7308 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
-Date: Fri, 2 Jan 2009 16:08:45 +0100
-Subject: [RFC 04/12] ath9k: introduce bus specific cleanup routine
+Date: Mon, 5 Jan 2009 10:59:29 +0100
+Subject: [PATCH v3 04/11] 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>
---
drivers/net/wireless/ath9k/core.h | 7 +++++++
- drivers/net/wireless/ath9k/main.c | 29 +++++++++++++++--------------
- 2 files changed, 22 insertions(+), 14 deletions(-)
+ drivers/net/wireless/ath9k/main.c | 37 +++++++++++++++++++++++--------------
+ 2 files changed, 30 insertions(+), 14 deletions(-)
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
-@@ -723,6 +723,8 @@ struct ath_bus_ops {
- void (*reg_write)(struct ath_hal *ah, unsigned reg, u32 val);
+@@ -695,6 +695,7 @@ enum PROT_MODE {
+ struct ath_bus_ops {
void (*read_cachesize)(struct ath_softc *sc, int *csz);
-+
+ void (*cleanup)(struct ath_softc *sc);
};
struct ath_softc {
-@@ -850,4 +852,9 @@ static inline void ath_read_cachesize(st
+@@ -704,6 +705,7 @@ struct ath_softc {
+ struct tasklet_struct bcon_tasklet;
+ struct ath_hal *sc_ah;
+ void __iomem *mem;
++ int irq;
+ spinlock_t sc_resetlock;
+ struct mutex mutex;
+
+@@ -760,4 +762,9 @@ static inline void ath_read_cachesize(st
sc->bus_ops->read_cachesize(sc, csz);
}
#endif /* CORE_H */
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
-@@ -1276,13 +1276,7 @@ static int ath_start_rfkill_poll(struct
+@@ -39,6 +39,7 @@ static struct pci_device_id ath_pci_id_t
+ };
+
+ static void ath_detach(struct ath_softc *sc);
++static void ath_cleanup(struct ath_softc *sc);
+
+ /* return bus cachesize in 4B word units */
+
+@@ -1269,13 +1270,7 @@ static int ath_start_rfkill_poll(struct
rfkill_free(sc->rf_kill.rfkill);
/* Deinitialize the device */
- ath_detach(sc);
-- if (sc->pdev->irq)
-- free_irq(sc->pdev->irq, sc);
-- pci_iounmap(sc->pdev, sc->mem);
-- pci_release_region(sc->pdev, 0);
-- pci_disable_device(sc->pdev);
+- if (to_pci_dev(sc->dev)->irq)
+- free_irq(to_pci_dev(sc->dev)->irq, sc);
+- pci_iounmap(to_pci_dev(sc->dev), sc->mem);
+- pci_release_region(to_pci_dev(sc->dev), 0);
+- pci_disable_device(to_pci_dev(sc->dev));
- ieee80211_free_hw(sc->hw);
-+ ath_bus_cleanup(sc);
++ ath_cleanup(sc);
return -EIO;
} else {
sc->sc_flags |= SC_OP_RFKILL_REGISTERED;
-@@ -2605,6 +2599,17 @@ static void ath_pci_reg_write(struct ath
- iowrite32(val, ah->ah_sh + reg);
+@@ -1286,6 +1281,14 @@ static int ath_start_rfkill_poll(struct
}
+ #endif /* CONFIG_RFKILL */
-+static void ath_pci_cleanup(struct ath_softc *sc)
++static void ath_cleanup(struct ath_softc *sc)
+{
+ ath_detach(sc);
-+ if (sc->pdev->irq)
-+ free_irq(sc->pdev->irq, sc);
-+ pci_iounmap(sc->pdev, sc->mem);
-+ pci_release_region(sc->pdev, 0);
-+ pci_disable_device(sc->pdev);
++ free_irq(sc->irq, sc);
++ ath_bus_cleanup(sc);
+ ieee80211_free_hw(sc->hw);
+}
+
- static struct ath_bus_ops ath_pci_bus_ops = {
- .dma_map_single_to_device = ath_pci_map_single_to_device,
- .dma_unmap_single_to_device = ath_pci_unmap_single_to_device,
-@@ -2620,6 +2625,8 @@ static struct ath_bus_ops ath_pci_bus_op
- .reg_write = ath_pci_reg_write,
+ static void ath_detach(struct ath_softc *sc)
+ {
+ struct ieee80211_hw *hw = sc->hw;
+@@ -2538,8 +2541,18 @@ ath_rf_name(u16 rf_version)
+ return "????";
+ }
- .read_cachesize = ath_pci_read_cachesize,
++static void ath_pci_cleanup(struct ath_softc *sc)
++{
++ struct pci_dev *pdev = to_pci_dev(sc->dev);
++
++ pci_iounmap(pdev, sc->mem);
++ pci_release_region(pdev, 0);
++ pci_disable_device(pdev);
++}
+
+ static struct ath_bus_ops ath_pci_bus_ops = {
+ .read_cachesize = ath_pci_read_cachesize,
+ .cleanup = ath_pci_cleanup,
};
static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-@@ -2756,13 +2763,7 @@ static void ath_pci_remove(struct pci_de
+@@ -2646,6 +2659,8 @@ static int ath_pci_probe(struct pci_dev
+ goto bad4;
+ }
+
++ sc->irq = pdev->irq;
++
+ ah = sc->sc_ah;
+ printk(KERN_INFO
+ "%s: Atheros AR%s MAC/BB Rev:%x "
+@@ -2676,13 +2691,7 @@ static void ath_pci_remove(struct pci_de
struct ieee80211_hw *hw = pci_get_drvdata(pdev);
struct ath_softc *sc = hw->priv;
- pci_release_region(pdev, 0);
- pci_disable_device(pdev);
- ieee80211_free_hw(hw);
-+ ath_pci_cleanup(sc);
++ ath_cleanup(sc);
}
#ifdef CONFIG_PM