1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
From 8f94fb99b3f88aeff95743633afcc88147b7a475 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Thu, 5 Mar 2009 15:07:10 +0100
Subject: [PATCH] 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>
---
drivers/net/wireless/ath9k/debug.c | 24 ++++++++++++++++++------
drivers/net/wireless/ath9k/debug.h | 12 +++++++++++-
drivers/net/wireless/ath9k/main.c | 13 ++++++++++++-
3 files changed, 41 insertions(+), 8 deletions(-)
--- a/drivers/net/wireless/ath9k/debug.c
+++ b/drivers/net/wireless/ath9k/debug.c
@@ -19,6 +19,8 @@
static unsigned int ath9k_debug = DBG_DEFAULT;
module_param_named(debug, ath9k_debug, uint, 0);
+static struct dentry *ath9k_debugfs_root;
+
void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...)
{
if (!sc)
@@ -491,12 +493,8 @@ int ath9k_init_debug(struct ath_softc *s
{
sc->debug.debug_mask = ath9k_debug;
- sc->debug.debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
- if (!sc->debug.debugfs_root)
- goto err;
-
sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
- sc->debug.debugfs_root);
+ ath9k_debugfs_root);
if (!sc->debug.debugfs_phy)
goto err;
@@ -538,5 +536,19 @@ void ath9k_exit_debug(struct ath_softc *
debugfs_remove(sc->debug.debugfs_interrupt);
debugfs_remove(sc->debug.debugfs_dma);
debugfs_remove(sc->debug.debugfs_phy);
- debugfs_remove(sc->debug.debugfs_root);
+}
+
+int ath9k_debug_create_root(void)
+{
+ ath9k_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
+ if (!ath9k_debugfs_root)
+ return -ENOENT;
+
+ return 0;
+}
+
+void ath9k_debug_remove_root(void)
+{
+ debugfs_remove(ath9k_debugfs_root);
+ ath9k_debugfs_root = NULL;
}
--- a/drivers/net/wireless/ath9k/debug.h
+++ b/drivers/net/wireless/ath9k/debug.h
@@ -102,7 +102,6 @@ struct ath_stats {
struct ath9k_debug {
int debug_mask;
- struct dentry *debugfs_root;
struct dentry *debugfs_phy;
struct dentry *debugfs_dma;
struct dentry *debugfs_interrupt;
@@ -114,6 +113,8 @@ struct ath9k_debug {
void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...);
int ath9k_init_debug(struct ath_softc *sc);
void ath9k_exit_debug(struct ath_softc *sc);
+int ath9k_debug_create_root(void);
+void ath9k_debug_remove_root(void);
void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb);
void ath_debug_stat_retries(struct ath_softc *sc, int rix,
@@ -135,6 +136,15 @@ static inline void ath9k_exit_debug(stru
{
}
+static inline int ath9k_debug_create_root(void)
+{
+ return 0;
+}
+
+static inline void ath9k_debug_remove_root(void)
+{
+}
+
static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
enum ath9k_int status)
{
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -2864,12 +2864,20 @@ static int __init ath9k_init(void)
goto err_out;
}
+ error = ath9k_debug_create_root();
+ if (error) {
+ printk(KERN_ERR
+ "ath9k: Unable to create debugfs root: %d\n",
+ error);
+ goto err_rate_unregister;
+ }
+
error = ath_pci_init();
if (error < 0) {
printk(KERN_ERR
"ath9k: No PCI devices found, driver not installed.\n");
error = -ENODEV;
- goto err_rate_unregister;
+ goto err_remove_root;
}
error = ath_ahb_init();
@@ -2883,6 +2891,8 @@ static int __init ath9k_init(void)
err_pci_exit:
ath_pci_exit();
+ err_remove_root:
+ ath9k_debug_remove_root();
err_rate_unregister:
ath_rate_control_unregister();
err_out:
@@ -2894,6 +2904,7 @@ static void __exit ath9k_exit(void)
{
ath_ahb_exit();
ath_pci_exit();
+ ath9k_debug_remove_root();
ath_rate_control_unregister();
printk(KERN_INFO "%s: Driver unloaded\n", dev_info);
}
|