1 From 8f94fb99b3f88aeff95743633afcc88147b7a475 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Thu, 5 Mar 2009 15:07:10 +0100
4 Subject: [PATCH] ath9k: create a common debugfs_root for all device instances
6 The driver are trying to create an 'ath9k' directory in debugfs for each
7 device currently. If there are more than one device in the system, the
8 second try will always fail.
10 Changes-licensed-under: ISC
12 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
13 Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
15 drivers/net/wireless/ath9k/debug.c | 24 ++++++++++++++++++------
16 drivers/net/wireless/ath9k/debug.h | 12 +++++++++++-
17 drivers/net/wireless/ath9k/main.c | 13 ++++++++++++-
18 3 files changed, 41 insertions(+), 8 deletions(-)
20 --- a/drivers/net/wireless/ath9k/debug.c
21 +++ b/drivers/net/wireless/ath9k/debug.c
23 static unsigned int ath9k_debug = DBG_DEFAULT;
24 module_param_named(debug, ath9k_debug, uint, 0);
26 +static struct dentry *ath9k_debugfs_root;
28 void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...)
31 @@ -491,12 +493,8 @@ int ath9k_init_debug(struct ath_softc *s
33 sc->debug.debug_mask = ath9k_debug;
35 - sc->debug.debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
36 - if (!sc->debug.debugfs_root)
39 sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
40 - sc->debug.debugfs_root);
41 + ath9k_debugfs_root);
42 if (!sc->debug.debugfs_phy)
45 @@ -538,5 +536,19 @@ void ath9k_exit_debug(struct ath_softc *
46 debugfs_remove(sc->debug.debugfs_interrupt);
47 debugfs_remove(sc->debug.debugfs_dma);
48 debugfs_remove(sc->debug.debugfs_phy);
49 - debugfs_remove(sc->debug.debugfs_root);
52 +int ath9k_debug_create_root(void)
54 + ath9k_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
55 + if (!ath9k_debugfs_root)
61 +void ath9k_debug_remove_root(void)
63 + debugfs_remove(ath9k_debugfs_root);
64 + ath9k_debugfs_root = NULL;
66 --- a/drivers/net/wireless/ath9k/debug.h
67 +++ b/drivers/net/wireless/ath9k/debug.h
68 @@ -102,7 +102,6 @@ struct ath_stats {
72 - struct dentry *debugfs_root;
73 struct dentry *debugfs_phy;
74 struct dentry *debugfs_dma;
75 struct dentry *debugfs_interrupt;
76 @@ -114,6 +113,8 @@ struct ath9k_debug {
77 void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...);
78 int ath9k_init_debug(struct ath_softc *sc);
79 void ath9k_exit_debug(struct ath_softc *sc);
80 +int ath9k_debug_create_root(void);
81 +void ath9k_debug_remove_root(void);
82 void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
83 void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb);
84 void ath_debug_stat_retries(struct ath_softc *sc, int rix,
85 @@ -135,6 +136,15 @@ static inline void ath9k_exit_debug(stru
89 +static inline int ath9k_debug_create_root(void)
94 +static inline void ath9k_debug_remove_root(void)
98 static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
99 enum ath9k_int status)
101 --- a/drivers/net/wireless/ath9k/main.c
102 +++ b/drivers/net/wireless/ath9k/main.c
103 @@ -2864,12 +2864,20 @@ static int __init ath9k_init(void)
107 + error = ath9k_debug_create_root();
110 + "ath9k: Unable to create debugfs root: %d\n",
112 + goto err_rate_unregister;
115 error = ath_pci_init();
118 "ath9k: No PCI devices found, driver not installed.\n");
120 - goto err_rate_unregister;
121 + goto err_remove_root;
124 error = ath_ahb_init();
125 @@ -2883,6 +2891,8 @@ static int __init ath9k_init(void)
130 + ath9k_debug_remove_root();
132 ath_rate_control_unregister();
134 @@ -2894,6 +2904,7 @@ static void __exit ath9k_exit(void)
138 + ath9k_debug_remove_root();
139 ath_rate_control_unregister();
140 printk(KERN_INFO "%s: Driver unloaded\n", dev_info);