ath5k: clean up debugfs code
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 469-ath5k_cleanup_debugfs.patch
1 --- a/drivers/net/wireless/ath/ath5k/debug.c
2 +++ b/drivers/net/wireless/ath/ath5k/debug.c
3 @@ -888,64 +888,37 @@ static const struct file_operations fops
4 void
5 ath5k_debug_init_device(struct ath5k_softc *sc)
6 {
7 + struct dentry *phydir;
8 +
9 sc->debug.level = ath5k_debug;
10
11 - sc->debug.debugfs_phydir = debugfs_create_dir("ath5k",
12 - sc->hw->wiphy->debugfsdir);
13 + phydir = debugfs_create_dir("ath5k", sc->hw->wiphy->debugfsdir);
14 + if (!phydir)
15 + return;
16
17 - sc->debug.debugfs_debug = debugfs_create_file("debug",
18 - S_IWUSR | S_IRUSR,
19 - sc->debug.debugfs_phydir, sc, &fops_debug);
20 -
21 - sc->debug.debugfs_registers = debugfs_create_file("registers", S_IRUSR,
22 - sc->debug.debugfs_phydir, sc, &fops_registers);
23 -
24 - sc->debug.debugfs_beacon = debugfs_create_file("beacon",
25 - S_IWUSR | S_IRUSR,
26 - sc->debug.debugfs_phydir, sc, &fops_beacon);
27 -
28 - sc->debug.debugfs_reset = debugfs_create_file("reset", S_IWUSR,
29 - sc->debug.debugfs_phydir, sc, &fops_reset);
30 -
31 - sc->debug.debugfs_antenna = debugfs_create_file("antenna",
32 - S_IWUSR | S_IRUSR,
33 - sc->debug.debugfs_phydir, sc, &fops_antenna);
34 -
35 - sc->debug.debugfs_misc = debugfs_create_file("misc",
36 - S_IRUSR,
37 - sc->debug.debugfs_phydir, sc, &fops_misc);
38 -
39 - sc->debug.debugfs_frameerrors = debugfs_create_file("frameerrors",
40 - S_IWUSR | S_IRUSR,
41 - sc->debug.debugfs_phydir, sc,
42 - &fops_frameerrors);
43 -
44 - sc->debug.debugfs_ani = debugfs_create_file("ani",
45 - S_IWUSR | S_IRUSR,
46 - sc->debug.debugfs_phydir, sc,
47 - &fops_ani);
48 -
49 - sc->debug.debugfs_queue = debugfs_create_file("queue",
50 - S_IWUSR | S_IRUSR,
51 - sc->debug.debugfs_phydir, sc,
52 - &fops_queue);
53 -}
54 + debugfs_create_file("debug", S_IWUSR | S_IRUSR, phydir, sc,
55 + &fops_debug);
56
57 -void
58 -ath5k_debug_finish_device(struct ath5k_softc *sc)
59 -{
60 - debugfs_remove(sc->debug.debugfs_debug);
61 - debugfs_remove(sc->debug.debugfs_registers);
62 - debugfs_remove(sc->debug.debugfs_beacon);
63 - debugfs_remove(sc->debug.debugfs_reset);
64 - debugfs_remove(sc->debug.debugfs_antenna);
65 - debugfs_remove(sc->debug.debugfs_misc);
66 - debugfs_remove(sc->debug.debugfs_frameerrors);
67 - debugfs_remove(sc->debug.debugfs_ani);
68 - debugfs_remove(sc->debug.debugfs_queue);
69 - debugfs_remove(sc->debug.debugfs_phydir);
70 -}
71 + debugfs_create_file("registers", S_IRUSR, phydir, sc, &fops_registers);
72 +
73 + debugfs_create_file("beacon", S_IWUSR | S_IRUSR, phydir, sc,
74 + &fops_beacon);
75
76 + debugfs_create_file("reset", S_IWUSR, phydir, sc, &fops_reset);
77 +
78 + debugfs_create_file("antenna", S_IWUSR | S_IRUSR, phydir, sc,
79 + &fops_antenna);
80 +
81 + debugfs_create_file("misc", S_IRUSR, phydir, sc, &fops_misc);
82 +
83 + debugfs_create_file("frameerrors", S_IWUSR | S_IRUSR, phydir, sc,
84 + &fops_frameerrors);
85 +
86 + debugfs_create_file("ani", S_IWUSR | S_IRUSR, phydir, sc, &fops_ani);
87 +
88 + debugfs_create_file("queue", S_IWUSR | S_IRUSR, phydir, sc,
89 + &fops_queue);
90 +}
91
92 /* functions used in other places */
93
94 --- a/drivers/net/wireless/ath/ath5k/debug.h
95 +++ b/drivers/net/wireless/ath/ath5k/debug.h
96 @@ -68,17 +68,6 @@ struct ath5k_buf;
97
98 struct ath5k_dbg_info {
99 unsigned int level; /* debug level */
100 - /* debugfs entries */
101 - struct dentry *debugfs_phydir;
102 - struct dentry *debugfs_debug;
103 - struct dentry *debugfs_registers;
104 - struct dentry *debugfs_beacon;
105 - struct dentry *debugfs_reset;
106 - struct dentry *debugfs_antenna;
107 - struct dentry *debugfs_misc;
108 - struct dentry *debugfs_frameerrors;
109 - struct dentry *debugfs_ani;
110 - struct dentry *debugfs_queue;
111 };
112
113 /**
114 @@ -141,9 +130,6 @@ void
115 ath5k_debug_init_device(struct ath5k_softc *sc);
116
117 void
118 -ath5k_debug_finish_device(struct ath5k_softc *sc);
119 -
120 -void
121 ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah);
122
123 void
124 @@ -167,9 +153,6 @@ static inline void
125 ath5k_debug_init_device(struct ath5k_softc *sc) {}
126
127 static inline void
128 -ath5k_debug_finish_device(struct ath5k_softc *sc) {}
129 -
130 -static inline void
131 ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah) {}
132
133 static inline void
134 --- a/drivers/net/wireless/ath/ath5k/base.c
135 +++ b/drivers/net/wireless/ath/ath5k/base.c
136 @@ -2901,7 +2901,6 @@ ath5k_deinit_softc(struct ath5k_softc *s
137 * XXX: ??? detach ath5k_hw ???
138 * Other than that, it's straightforward...
139 */
140 - ath5k_debug_finish_device(sc);
141 ieee80211_unregister_hw(hw);
142 ath5k_desc_free(sc);
143 ath5k_txq_release(sc);