summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath9k/main.c
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-01-14 20:17:05 +0100
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 16:00:30 -0500
commit39c3c2f2de6bccf698bfb5b9c4f56ddf99de0dbc (patch)
tree7ca6a1066ba36a318e47d6899c925109e3f8a08d /drivers/net/wireless/ath9k/main.c
parent88d15707644fad1a137af7a17b00da6135f1c1a8 (diff)
downloadlwn-39c3c2f2de6bccf698bfb5b9c4f56ddf99de0dbc.tar.gz
lwn-39c3c2f2de6bccf698bfb5b9c4f56ddf99de0dbc.zip
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/net/wireless/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath9k/main.c37
1 files changed, 23 insertions, 14 deletions
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 = {
};
static void ath_detach(struct ath_softc *sc);
+static void ath_cleanup(struct ath_softc *sc);
/* return bus cachesize in 4B word units */
@@ -1267,13 +1268,7 @@ static int ath_start_rfkill_poll(struct ath_softc *sc)
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);
+ ath_cleanup(sc);
return -EIO;
} else {
sc->sc_flags |= SC_OP_RFKILL_REGISTERED;
@@ -1284,6 +1279,14 @@ static int ath_start_rfkill_poll(struct ath_softc *sc)
}
#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;
@@ -2534,8 +2537,18 @@ ath_rf_name(u16 rf_version)
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)
@@ -2642,6 +2655,8 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto bad4;
}
+ sc->irq = pdev->irq;
+
ah = sc->sc_ah;
printk(KERN_INFO
"%s: Atheros AR%s MAC/BB Rev:%x "
@@ -2672,13 +2687,7 @@ static void ath_pci_remove(struct pci_dev *pdev)
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);
+ ath_cleanup(sc);
}
#ifdef CONFIG_PM