diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2009-03-05 10:55:18 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-03-16 18:09:27 -0400 |
commit | 19d8bc22bcea749da2ba065a1ff9e054fadb556e (patch) | |
tree | 69c5d473198e963bdb298fb9411e1f52f7770067 /drivers/net/wireless | |
parent | 0eeb59fe2cd84b62f374874a59e62402e13f48b3 (diff) |
ath9k: create a common debugfs_root for all device instances
The driver are trying to create an 'ath9k' directory in debugfs for each
device currently. If there are more than one device in the system, the
second try will always fail.
Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath9k/debug.c | 24 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/debug.h | 12 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 13 |
3 files changed, 41 insertions, 8 deletions
diff --git a/drivers/net/wireless/ath9k/debug.c b/drivers/net/wireless/ath9k/debug.c index 8d91422106d9..0f7e249d2d2e 100644 --- a/drivers/net/wireless/ath9k/debug.c +++ b/drivers/net/wireless/ath9k/debug.c | |||
@@ -19,6 +19,8 @@ | |||
19 | static unsigned int ath9k_debug = DBG_DEFAULT; | 19 | static unsigned int ath9k_debug = DBG_DEFAULT; |
20 | module_param_named(debug, ath9k_debug, uint, 0); | 20 | module_param_named(debug, ath9k_debug, uint, 0); |
21 | 21 | ||
22 | static struct dentry *ath9k_debugfs_root; | ||
23 | |||
22 | void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...) | 24 | void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...) |
23 | { | 25 | { |
24 | if (!sc) | 26 | if (!sc) |
@@ -491,12 +493,8 @@ int ath9k_init_debug(struct ath_softc *sc) | |||
491 | { | 493 | { |
492 | sc->debug.debug_mask = ath9k_debug; | 494 | sc->debug.debug_mask = ath9k_debug; |
493 | 495 | ||
494 | sc->debug.debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); | ||
495 | if (!sc->debug.debugfs_root) | ||
496 | goto err; | ||
497 | |||
498 | sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy), | 496 | sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy), |
499 | sc->debug.debugfs_root); | 497 | ath9k_debugfs_root); |
500 | if (!sc->debug.debugfs_phy) | 498 | if (!sc->debug.debugfs_phy) |
501 | goto err; | 499 | goto err; |
502 | 500 | ||
@@ -538,5 +536,19 @@ void ath9k_exit_debug(struct ath_softc *sc) | |||
538 | debugfs_remove(sc->debug.debugfs_interrupt); | 536 | debugfs_remove(sc->debug.debugfs_interrupt); |
539 | debugfs_remove(sc->debug.debugfs_dma); | 537 | debugfs_remove(sc->debug.debugfs_dma); |
540 | debugfs_remove(sc->debug.debugfs_phy); | 538 | debugfs_remove(sc->debug.debugfs_phy); |
541 | debugfs_remove(sc->debug.debugfs_root); | 539 | } |
540 | |||
541 | int ath9k_debug_create_root(void) | ||
542 | { | ||
543 | ath9k_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); | ||
544 | if (!ath9k_debugfs_root) | ||
545 | return -ENOENT; | ||
546 | |||
547 | return 0; | ||
548 | } | ||
549 | |||
550 | void ath9k_debug_remove_root(void) | ||
551 | { | ||
552 | debugfs_remove(ath9k_debugfs_root); | ||
553 | ath9k_debugfs_root = NULL; | ||
542 | } | 554 | } |
diff --git a/drivers/net/wireless/ath9k/debug.h b/drivers/net/wireless/ath9k/debug.h index 2a33d74fdbee..065268b8568f 100644 --- a/drivers/net/wireless/ath9k/debug.h +++ b/drivers/net/wireless/ath9k/debug.h | |||
@@ -102,7 +102,6 @@ struct ath_stats { | |||
102 | 102 | ||
103 | struct ath9k_debug { | 103 | struct ath9k_debug { |
104 | int debug_mask; | 104 | int debug_mask; |
105 | struct dentry *debugfs_root; | ||
106 | struct dentry *debugfs_phy; | 105 | struct dentry *debugfs_phy; |
107 | struct dentry *debugfs_dma; | 106 | struct dentry *debugfs_dma; |
108 | struct dentry *debugfs_interrupt; | 107 | struct dentry *debugfs_interrupt; |
@@ -114,6 +113,8 @@ struct ath9k_debug { | |||
114 | void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...); | 113 | void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...); |
115 | int ath9k_init_debug(struct ath_softc *sc); | 114 | int ath9k_init_debug(struct ath_softc *sc); |
116 | void ath9k_exit_debug(struct ath_softc *sc); | 115 | void ath9k_exit_debug(struct ath_softc *sc); |
116 | int ath9k_debug_create_root(void); | ||
117 | void ath9k_debug_remove_root(void); | ||
117 | void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); | 118 | void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); |
118 | void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb); | 119 | void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb); |
119 | void ath_debug_stat_retries(struct ath_softc *sc, int rix, | 120 | void ath_debug_stat_retries(struct ath_softc *sc, int rix, |
@@ -135,6 +136,15 @@ static inline void ath9k_exit_debug(struct ath_softc *sc) | |||
135 | { | 136 | { |
136 | } | 137 | } |
137 | 138 | ||
139 | static inline int ath9k_debug_create_root(void) | ||
140 | { | ||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | static inline void ath9k_debug_remove_root(void) | ||
145 | { | ||
146 | } | ||
147 | |||
138 | static inline void ath_debug_stat_interrupt(struct ath_softc *sc, | 148 | static inline void ath_debug_stat_interrupt(struct ath_softc *sc, |
139 | enum ath9k_int status) | 149 | enum ath9k_int status) |
140 | { | 150 | { |
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index f473fee72a2e..bb30ccca1843 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -2858,12 +2858,20 @@ static int __init ath9k_init(void) | |||
2858 | goto err_out; | 2858 | goto err_out; |
2859 | } | 2859 | } |
2860 | 2860 | ||
2861 | error = ath9k_debug_create_root(); | ||
2862 | if (error) { | ||
2863 | printk(KERN_ERR | ||
2864 | "ath9k: Unable to create debugfs root: %d\n", | ||
2865 | error); | ||
2866 | goto err_rate_unregister; | ||
2867 | } | ||
2868 | |||
2861 | error = ath_pci_init(); | 2869 | error = ath_pci_init(); |
2862 | if (error < 0) { | 2870 | if (error < 0) { |
2863 | printk(KERN_ERR | 2871 | printk(KERN_ERR |
2864 | "ath9k: No PCI devices found, driver not installed.\n"); | 2872 | "ath9k: No PCI devices found, driver not installed.\n"); |
2865 | error = -ENODEV; | 2873 | error = -ENODEV; |
2866 | goto err_rate_unregister; | 2874 | goto err_remove_root; |
2867 | } | 2875 | } |
2868 | 2876 | ||
2869 | error = ath_ahb_init(); | 2877 | error = ath_ahb_init(); |
@@ -2877,6 +2885,8 @@ static int __init ath9k_init(void) | |||
2877 | err_pci_exit: | 2885 | err_pci_exit: |
2878 | ath_pci_exit(); | 2886 | ath_pci_exit(); |
2879 | 2887 | ||
2888 | err_remove_root: | ||
2889 | ath9k_debug_remove_root(); | ||
2880 | err_rate_unregister: | 2890 | err_rate_unregister: |
2881 | ath_rate_control_unregister(); | 2891 | ath_rate_control_unregister(); |
2882 | err_out: | 2892 | err_out: |
@@ -2888,6 +2898,7 @@ static void __exit ath9k_exit(void) | |||
2888 | { | 2898 | { |
2889 | ath_ahb_exit(); | 2899 | ath_ahb_exit(); |
2890 | ath_pci_exit(); | 2900 | ath_pci_exit(); |
2901 | ath9k_debug_remove_root(); | ||
2891 | ath_rate_control_unregister(); | 2902 | ath_rate_control_unregister(); |
2892 | printk(KERN_INFO "%s: Driver unloaded\n", dev_info); | 2903 | printk(KERN_INFO "%s: Driver unloaded\n", dev_info); |
2893 | } | 2904 | } |