[package] kernel: added GPIO driver for CS5535/CS5536 companion chip. Thanks Markus...
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 404-ath9k-introduce-bus-specific-cleanup-routine.patch
1 From d23e90c384edfbf039cb8b8d94c0ef90022949e7 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Fri, 2 Jan 2009 16:08:45 +0100
4 Subject: [RFC 04/12] ath9k: introduce bus specific cleanup routine
5
6 We have left only some PCI specific cleanup code. We have to convert
7 them as well.
8
9 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
10 Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
11 ---
12 drivers/net/wireless/ath9k/core.h | 7 +++++++
13 drivers/net/wireless/ath9k/main.c | 29 +++++++++++++++--------------
14 2 files changed, 22 insertions(+), 14 deletions(-)
15
16 --- a/drivers/net/wireless/ath9k/core.h
17 +++ b/drivers/net/wireless/ath9k/core.h
18 @@ -723,6 +723,8 @@ struct ath_bus_ops {
19 void (*reg_write)(struct ath_hal *ah, unsigned reg, u32 val);
20
21 void (*read_cachesize)(struct ath_softc *sc, int *csz);
22 +
23 + void (*cleanup)(struct ath_softc *sc);
24 };
25
26 struct ath_softc {
27 @@ -850,4 +852,9 @@ static inline void ath_read_cachesize(st
28 sc->bus_ops->read_cachesize(sc, csz);
29 }
30
31 +static inline void ath_bus_cleanup(struct ath_softc *sc)
32 +{
33 + sc->bus_ops->cleanup(sc);
34 +}
35 +
36 #endif /* CORE_H */
37 --- a/drivers/net/wireless/ath9k/main.c
38 +++ b/drivers/net/wireless/ath9k/main.c
39 @@ -1276,13 +1276,7 @@ static int ath_start_rfkill_poll(struct
40 rfkill_free(sc->rf_kill.rfkill);
41
42 /* Deinitialize the device */
43 - ath_detach(sc);
44 - if (sc->pdev->irq)
45 - free_irq(sc->pdev->irq, sc);
46 - pci_iounmap(sc->pdev, sc->mem);
47 - pci_release_region(sc->pdev, 0);
48 - pci_disable_device(sc->pdev);
49 - ieee80211_free_hw(sc->hw);
50 + ath_bus_cleanup(sc);
51 return -EIO;
52 } else {
53 sc->sc_flags |= SC_OP_RFKILL_REGISTERED;
54 @@ -2605,6 +2599,17 @@ static void ath_pci_reg_write(struct ath
55 iowrite32(val, ah->ah_sh + reg);
56 }
57
58 +static void ath_pci_cleanup(struct ath_softc *sc)
59 +{
60 + ath_detach(sc);
61 + if (sc->pdev->irq)
62 + free_irq(sc->pdev->irq, sc);
63 + pci_iounmap(sc->pdev, sc->mem);
64 + pci_release_region(sc->pdev, 0);
65 + pci_disable_device(sc->pdev);
66 + ieee80211_free_hw(sc->hw);
67 +}
68 +
69 static struct ath_bus_ops ath_pci_bus_ops = {
70 .dma_map_single_to_device = ath_pci_map_single_to_device,
71 .dma_unmap_single_to_device = ath_pci_unmap_single_to_device,
72 @@ -2620,6 +2625,8 @@ static struct ath_bus_ops ath_pci_bus_op
73 .reg_write = ath_pci_reg_write,
74
75 .read_cachesize = ath_pci_read_cachesize,
76 +
77 + .cleanup = ath_pci_cleanup,
78 };
79
80 static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
81 @@ -2756,13 +2763,7 @@ static void ath_pci_remove(struct pci_de
82 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
83 struct ath_softc *sc = hw->priv;
84
85 - ath_detach(sc);
86 - if (pdev->irq)
87 - free_irq(pdev->irq, sc);
88 - pci_iounmap(pdev, sc->mem);
89 - pci_release_region(pdev, 0);
90 - pci_disable_device(pdev);
91 - ieee80211_free_hw(hw);
92 + ath_pci_cleanup(sc);
93 }
94
95 #ifdef CONFIG_PM