2009-01-09 14:38:08 +02:00
|
|
|
From 7524b77fe24a4464b08a2ac987ec22711a4f2027 Mon Sep 17 00:00:00 2001
|
2009-01-07 20:21:53 +02:00
|
|
|
From: Gabor Juhos <juhosg@openwrt.org>
|
|
|
|
Date: Mon, 5 Jan 2009 10:59:29 +0100
|
2009-01-09 14:38:08 +02:00
|
|
|
Subject: [PATCH v2 04/11] ath9k: introduce bus specific cleanup routine
|
2009-01-07 20:21:53 +02:00
|
|
|
|
|
|
|
We have left only some PCI specific cleanup code. We have to convert
|
|
|
|
them as well.
|
|
|
|
|
|
|
|
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
|
|
|
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
|
|
|
|
---
|
2009-01-09 14:38:08 +02:00
|
|
|
drivers/net/wireless/ath9k/core.h | 7 +++++++
|
|
|
|
drivers/net/wireless/ath9k/main.c | 37 +++++++++++++++++++++++--------------
|
|
|
|
2 files changed, 30 insertions(+), 14 deletions(-)
|
2009-01-07 20:21:53 +02:00
|
|
|
|
|
|
|
--- a/drivers/net/wireless/ath9k/core.h
|
|
|
|
+++ b/drivers/net/wireless/ath9k/core.h
|
|
|
|
@@ -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 {
|
2009-01-09 14:38:08 +02:00
|
|
|
@@ -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
|
2009-01-07 20:21:53 +02:00
|
|
|
sc->bus_ops->read_cachesize(sc, csz);
|
|
|
|
}
|
|
|
|
|
|
|
|
+static inline void ath_bus_cleanup(struct ath_softc *sc)
|
|
|
|
+{
|
|
|
|
+ sc->bus_ops->cleanup(sc);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
#endif /* CORE_H */
|
|
|
|
--- a/drivers/net/wireless/ath9k/main.c
|
|
|
|
+++ b/drivers/net/wireless/ath9k/main.c
|
2009-01-09 14:38:08 +02:00
|
|
|
@@ -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 */
|
|
|
|
|
2009-01-10 21:23:09 +02:00
|
|
|
@@ -1269,13 +1270,7 @@ static int ath_start_rfkill_poll(struct
|
2009-01-07 20:21:53 +02:00
|
|
|
rfkill_free(sc->rf_kill.rfkill);
|
|
|
|
|
|
|
|
/* Deinitialize the device */
|
|
|
|
- ath_detach(sc);
|
|
|
|
- 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);
|
2009-01-09 14:38:08 +02:00
|
|
|
+ ath_cleanup(sc);
|
2009-01-07 20:21:53 +02:00
|
|
|
return -EIO;
|
|
|
|
} else {
|
|
|
|
sc->sc_flags |= SC_OP_RFKILL_REGISTERED;
|
2009-01-10 21:23:09 +02:00
|
|
|
@@ -1286,6 +1281,14 @@ static int ath_start_rfkill_poll(struct
|
2009-01-09 14:38:08 +02:00
|
|
|
}
|
|
|
|
#endif /* CONFIG_RFKILL */
|
|
|
|
|
|
|
|
+static void ath_cleanup(struct ath_softc *sc)
|
|
|
|
+{
|
|
|
|
+ ath_detach(sc);
|
|
|
|
+ free_irq(sc->irq, sc);
|
|
|
|
+ ath_bus_cleanup(sc);
|
|
|
|
+ ieee80211_free_hw(sc->hw);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static void ath_detach(struct ath_softc *sc)
|
|
|
|
{
|
|
|
|
struct ieee80211_hw *hw = sc->hw;
|
2009-01-10 21:23:09 +02:00
|
|
|
@@ -2538,8 +2541,18 @@ ath_rf_name(u16 rf_version)
|
2009-01-07 20:21:53 +02:00
|
|
|
return "????";
|
|
|
|
}
|
|
|
|
|
|
|
|
+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)
|
2009-01-10 21:23:09 +02:00
|
|
|
@@ -2646,6 +2659,8 @@ static int ath_pci_probe(struct pci_dev
|
2009-01-09 14:38:08 +02:00
|
|
|
goto bad4;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ sc->irq = pdev->irq;
|
|
|
|
+
|
|
|
|
ah = sc->sc_ah;
|
|
|
|
printk(KERN_INFO
|
|
|
|
"%s: Atheros AR%s MAC/BB Rev:%x "
|
2009-01-10 21:23:09 +02:00
|
|
|
@@ -2676,13 +2691,7 @@ static void ath_pci_remove(struct pci_de
|
2009-01-07 20:21:53 +02:00
|
|
|
struct ieee80211_hw *hw = pci_get_drvdata(pdev);
|
|
|
|
struct ath_softc *sc = hw->priv;
|
|
|
|
|
|
|
|
- ath_detach(sc);
|
|
|
|
- if (pdev->irq)
|
|
|
|
- free_irq(pdev->irq, sc);
|
|
|
|
- pci_iounmap(pdev, sc->mem);
|
|
|
|
- pci_release_region(pdev, 0);
|
|
|
|
- pci_disable_device(pdev);
|
|
|
|
- ieee80211_free_hw(hw);
|
2009-01-09 14:38:08 +02:00
|
|
|
+ ath_cleanup(sc);
|
2009-01-07 20:21:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_PM
|