diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2008-11-28 11:50:23 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-12-05 09:35:09 -0500 |
commit | 826d268091f0e0ecc50103f648b6183eb3efe04d (patch) | |
tree | 16f9f535377f47501fac33e9f72a70ae7b47a0fb /drivers | |
parent | 16d68abee5d700bfe09ae8324dbb76028995c589 (diff) |
ath9k: Add initial layout for an ath9k specific debugfs mechanism
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath9k/core.h | 20 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/debug.c | 26 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 4 |
3 files changed, 42 insertions, 8 deletions
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h index 44938793d6ef..5b755582b33e 100644 --- a/drivers/net/wireless/ath9k/core.h +++ b/drivers/net/wireless/ath9k/core.h | |||
@@ -88,8 +88,15 @@ enum ATH_DEBUG { | |||
88 | 88 | ||
89 | #ifdef CONFIG_ATH9K_DEBUG | 89 | #ifdef CONFIG_ATH9K_DEBUG |
90 | 90 | ||
91 | struct ath9k_debug { | ||
92 | int debug_mask; | ||
93 | struct dentry *debugfs_root; | ||
94 | struct dentry *debugfs_phy; | ||
95 | }; | ||
96 | |||
91 | void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...); | 97 | void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...); |
92 | void ath9k_init_debug(struct ath_softc *sc); | 98 | int ath9k_init_debug(struct ath_softc *sc); |
99 | void ath9k_exit_debug(struct ath_softc *sc); | ||
93 | 100 | ||
94 | #else | 101 | #else |
95 | 102 | ||
@@ -98,11 +105,16 @@ static inline void DPRINTF(struct ath_softc *sc, int dbg_mask, | |||
98 | { | 105 | { |
99 | } | 106 | } |
100 | 107 | ||
101 | static inline ath9k_init_debug(struct ath_softc *sc) | 108 | static inline int ath9k_init_debug(struct ath_softc *sc) |
102 | { | 109 | { |
110 | return 0; | ||
103 | } | 111 | } |
104 | 112 | ||
105 | #endif | 113 | static inline void ath9k_exit_debug(struct ath_softc *sc) |
114 | { | ||
115 | } | ||
116 | |||
117 | #endif /* CONFIG_ATH9K_DEBUG */ | ||
106 | 118 | ||
107 | struct ath_config { | 119 | struct ath_config { |
108 | u32 ath_aggr_prot; | 120 | u32 ath_aggr_prot; |
@@ -619,7 +631,7 @@ struct ath_softc { | |||
619 | u8 sc_bssidmask[ETH_ALEN]; | 631 | u8 sc_bssidmask[ETH_ALEN]; |
620 | 632 | ||
621 | #ifdef CONFIG_ATH9K_DEBUG | 633 | #ifdef CONFIG_ATH9K_DEBUG |
622 | int sc_debug; | 634 | struct ath9k_debug sc_debug; |
623 | #endif | 635 | #endif |
624 | u32 sc_intrstatus; | 636 | u32 sc_intrstatus; |
625 | u32 sc_flags; /* SC_OP_* */ | 637 | u32 sc_flags; /* SC_OP_* */ |
diff --git a/drivers/net/wireless/ath9k/debug.c b/drivers/net/wireless/ath9k/debug.c index 31af7cc0fa34..c146e484ef54 100644 --- a/drivers/net/wireless/ath9k/debug.c +++ b/drivers/net/wireless/ath9k/debug.c | |||
@@ -24,7 +24,7 @@ void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...) | |||
24 | if (!sc) | 24 | if (!sc) |
25 | return; | 25 | return; |
26 | 26 | ||
27 | if (sc->sc_debug & dbg_mask) { | 27 | if (sc->sc_debug.debug_mask & dbg_mask) { |
28 | va_list args; | 28 | va_list args; |
29 | 29 | ||
30 | va_start(args, fmt); | 30 | va_start(args, fmt); |
@@ -34,7 +34,27 @@ void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...) | |||
34 | } | 34 | } |
35 | } | 35 | } |
36 | 36 | ||
37 | void ath9k_init_debug(struct ath_softc *sc) | 37 | int ath9k_init_debug(struct ath_softc *sc) |
38 | { | 38 | { |
39 | sc->sc_debug = ath9k_debug; | 39 | sc->sc_debug.debug_mask = ath9k_debug; |
40 | |||
41 | sc->sc_debug.debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); | ||
42 | if (!sc->sc_debug.debugfs_root) | ||
43 | goto err; | ||
44 | |||
45 | sc->sc_debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy), | ||
46 | sc->sc_debug.debugfs_root); | ||
47 | if (!sc->sc_debug.debugfs_phy) | ||
48 | goto err; | ||
49 | |||
50 | return 0; | ||
51 | err: | ||
52 | ath9k_exit_debug(sc); | ||
53 | return -ENOMEM; | ||
54 | } | ||
55 | |||
56 | void ath9k_exit_debug(struct ath_softc *sc) | ||
57 | { | ||
58 | debugfs_remove(sc->sc_debug.debugfs_phy); | ||
59 | debugfs_remove(sc->sc_debug.debugfs_root); | ||
40 | } | 60 | } |
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 9e7045dd7334..71389643b1b1 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -1299,6 +1299,7 @@ static void ath_detach(struct ath_softc *sc) | |||
1299 | ath_tx_cleanupq(sc, &sc->sc_txq[i]); | 1299 | ath_tx_cleanupq(sc, &sc->sc_txq[i]); |
1300 | 1300 | ||
1301 | ath9k_hw_detach(sc->sc_ah); | 1301 | ath9k_hw_detach(sc->sc_ah); |
1302 | ath9k_exit_debug(sc); | ||
1302 | } | 1303 | } |
1303 | 1304 | ||
1304 | static int ath_init(u16 devid, struct ath_softc *sc) | 1305 | static int ath_init(u16 devid, struct ath_softc *sc) |
@@ -1311,7 +1312,8 @@ static int ath_init(u16 devid, struct ath_softc *sc) | |||
1311 | /* XXX: hardware will not be ready until ath_open() being called */ | 1312 | /* XXX: hardware will not be ready until ath_open() being called */ |
1312 | sc->sc_flags |= SC_OP_INVALID; | 1313 | sc->sc_flags |= SC_OP_INVALID; |
1313 | 1314 | ||
1314 | ath9k_init_debug(sc); | 1315 | if (ath9k_init_debug(sc) < 0) |
1316 | printk(KERN_ERR "Unable to create debugfs files\n"); | ||
1315 | 1317 | ||
1316 | spin_lock_init(&sc->sc_resetlock); | 1318 | spin_lock_init(&sc->sc_resetlock); |
1317 | tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc); | 1319 | tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc); |