aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-12-02 22:12:35 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-12-07 16:34:39 -0500
commit21a99f934949807dc0c9dc7642bbf0081b7582f9 (patch)
tree06411011aa5655d73d809d873d2d80d17842e047 /drivers
parent0ab82b04ac83a05bda3ef8499f415fc6fd6ee206 (diff)
ath: Add and use ath_printk and ath_<level>
Add ath_printk and ath_<level> similar to dev_printk and dev_<level> from device.h This allows a more gradual rename of ath_print to to ath_dbg or perhaps ath_debug. This basically removes debug.h leaving only an #define ath_printk ath_dbg there and moving all the ATH_DBG_<foo> enums to ath.h I do not think there's much purpose for struct ath_common * being passed to the ath_printk functions, but perhaps there might be. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath.h103
-rw-r--r--drivers/net/wireless/ath/debug.c20
-rw-r--r--drivers/net/wireless/ath/debug.h72
-rw-r--r--drivers/net/wireless/ath/main.c20
4 files changed, 124 insertions, 91 deletions
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index 26bdbeee424f..c914f5213c61 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -186,4 +186,107 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry);
186void ath_hw_cycle_counters_update(struct ath_common *common); 186void ath_hw_cycle_counters_update(struct ath_common *common);
187int32_t ath_hw_get_listen_time(struct ath_common *common); 187int32_t ath_hw_get_listen_time(struct ath_common *common);
188 188
189extern __attribute__ ((format (printf, 3, 4))) int
190ath_printk(const char *level, struct ath_common *common, const char *fmt, ...);
191
192#define ath_emerg(common, fmt, ...) \
193 ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__)
194#define ath_alert(common, fmt, ...) \
195 ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__)
196#define ath_crit(common, fmt, ...) \
197 ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__)
198#define ath_err(common, fmt, ...) \
199 ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__)
200#define ath_warn(common, fmt, ...) \
201 ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__)
202#define ath_notice(common, fmt, ...) \
203 ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__)
204#define ath_info(common, fmt, ...) \
205 ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__)
206
207/**
208 * enum ath_debug_level - atheros wireless debug level
209 *
210 * @ATH_DBG_RESET: reset processing
211 * @ATH_DBG_QUEUE: hardware queue management
212 * @ATH_DBG_EEPROM: eeprom processing
213 * @ATH_DBG_CALIBRATE: periodic calibration
214 * @ATH_DBG_INTERRUPT: interrupt processing
215 * @ATH_DBG_REGULATORY: regulatory processing
216 * @ATH_DBG_ANI: adaptive noise immunitive processing
217 * @ATH_DBG_XMIT: basic xmit operation
218 * @ATH_DBG_BEACON: beacon handling
219 * @ATH_DBG_CONFIG: configuration of the hardware
220 * @ATH_DBG_FATAL: fatal errors, this is the default, DBG_DEFAULT
221 * @ATH_DBG_PS: power save processing
222 * @ATH_DBG_HWTIMER: hardware timer handling
223 * @ATH_DBG_BTCOEX: bluetooth coexistance
224 * @ATH_DBG_BSTUCK: stuck beacons
225 * @ATH_DBG_ANY: enable all debugging
226 *
227 * The debug level is used to control the amount and type of debugging output
228 * we want to see. Each driver has its own method for enabling debugging and
229 * modifying debug level states -- but this is typically done through a
230 * module parameter 'debug' along with a respective 'debug' debugfs file
231 * entry.
232 */
233enum ATH_DEBUG {
234 ATH_DBG_RESET = 0x00000001,
235 ATH_DBG_QUEUE = 0x00000002,
236 ATH_DBG_EEPROM = 0x00000004,
237 ATH_DBG_CALIBRATE = 0x00000008,
238 ATH_DBG_INTERRUPT = 0x00000010,
239 ATH_DBG_REGULATORY = 0x00000020,
240 ATH_DBG_ANI = 0x00000040,
241 ATH_DBG_XMIT = 0x00000080,
242 ATH_DBG_BEACON = 0x00000100,
243 ATH_DBG_CONFIG = 0x00000200,
244 ATH_DBG_FATAL = 0x00000400,
245 ATH_DBG_PS = 0x00000800,
246 ATH_DBG_HWTIMER = 0x00001000,
247 ATH_DBG_BTCOEX = 0x00002000,
248 ATH_DBG_WMI = 0x00004000,
249 ATH_DBG_BSTUCK = 0x00008000,
250 ATH_DBG_ANY = 0xffffffff
251};
252
253#define ATH_DBG_DEFAULT (ATH_DBG_FATAL)
254
255#ifdef CONFIG_ATH_DEBUG
256
257#define ath_dbg(common, dbg_mask, fmt, ...) \
258({ \
259 int rtn; \
260 if ((common)->debug_mask & dbg_mask) \
261 rtn = ath_printk(KERN_DEBUG, common, fmt, \
262 ##__VA_ARGS__); \
263 else \
264 rtn = 0; \
265 \
266 rtn; \
267})
268#define ATH_DBG_WARN(foo, arg...) WARN(foo, arg)
269
270#else
271
272static inline __attribute__ ((format (printf, 3, 4))) int
273ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask,
274 const char *fmt, ...)
275{
276 return 0;
277}
278#define ATH_DBG_WARN(foo, arg...) do {} while (0)
279
280#endif /* CONFIG_ATH_DEBUG */
281
282/** Returns string describing opmode, or NULL if unknown mode. */
283#ifdef CONFIG_ATH_DEBUG
284const char *ath_opmode_to_string(enum nl80211_iftype opmode);
285#else
286static inline const char *ath_opmode_to_string(enum nl80211_iftype opmode)
287{
288 return "UNKNOWN";
289}
290#endif
291
189#endif /* ATH_H */ 292#endif /* ATH_H */
diff --git a/drivers/net/wireless/ath/debug.c b/drivers/net/wireless/ath/debug.c
index a9600ba8ceaa..5367b1086e09 100644
--- a/drivers/net/wireless/ath/debug.c
+++ b/drivers/net/wireless/ath/debug.c
@@ -15,26 +15,6 @@
15 */ 15 */
16 16
17#include "ath.h" 17#include "ath.h"
18#include "debug.h"
19
20void ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...)
21{
22 struct va_format vaf;
23 va_list args;
24
25 if (likely(!(common->debug_mask & dbg_mask)))
26 return;
27
28 va_start(args, fmt);
29
30 vaf.fmt = fmt;
31 vaf.va = &args;
32
33 printk(KERN_DEBUG "ath: %pV", &vaf);
34
35 va_end(args);
36}
37EXPORT_SYMBOL(ath_print);
38 18
39const char *ath_opmode_to_string(enum nl80211_iftype opmode) 19const char *ath_opmode_to_string(enum nl80211_iftype opmode)
40{ 20{
diff --git a/drivers/net/wireless/ath/debug.h b/drivers/net/wireless/ath/debug.h
index f207007ee391..cec951cdfac1 100644
--- a/drivers/net/wireless/ath/debug.h
+++ b/drivers/net/wireless/ath/debug.h
@@ -17,76 +17,6 @@
17#ifndef ATH_DEBUG_H 17#ifndef ATH_DEBUG_H
18#define ATH_DEBUG_H 18#define ATH_DEBUG_H
19 19
20#include "ath.h" 20#define ath_print ath_dbg
21
22/**
23 * enum ath_debug_level - atheros wireless debug level
24 *
25 * @ATH_DBG_RESET: reset processing
26 * @ATH_DBG_QUEUE: hardware queue management
27 * @ATH_DBG_EEPROM: eeprom processing
28 * @ATH_DBG_CALIBRATE: periodic calibration
29 * @ATH_DBG_INTERRUPT: interrupt processing
30 * @ATH_DBG_REGULATORY: regulatory processing
31 * @ATH_DBG_ANI: adaptive noise immunitive processing
32 * @ATH_DBG_XMIT: basic xmit operation
33 * @ATH_DBG_BEACON: beacon handling
34 * @ATH_DBG_CONFIG: configuration of the hardware
35 * @ATH_DBG_FATAL: fatal errors, this is the default, DBG_DEFAULT
36 * @ATH_DBG_PS: power save processing
37 * @ATH_DBG_HWTIMER: hardware timer handling
38 * @ATH_DBG_BTCOEX: bluetooth coexistance
39 * @ATH_DBG_BSTUCK: stuck beacons
40 * @ATH_DBG_ANY: enable all debugging
41 *
42 * The debug level is used to control the amount and type of debugging output
43 * we want to see. Each driver has its own method for enabling debugging and
44 * modifying debug level states -- but this is typically done through a
45 * module parameter 'debug' along with a respective 'debug' debugfs file
46 * entry.
47 */
48enum ATH_DEBUG {
49 ATH_DBG_RESET = 0x00000001,
50 ATH_DBG_QUEUE = 0x00000002,
51 ATH_DBG_EEPROM = 0x00000004,
52 ATH_DBG_CALIBRATE = 0x00000008,
53 ATH_DBG_INTERRUPT = 0x00000010,
54 ATH_DBG_REGULATORY = 0x00000020,
55 ATH_DBG_ANI = 0x00000040,
56 ATH_DBG_XMIT = 0x00000080,
57 ATH_DBG_BEACON = 0x00000100,
58 ATH_DBG_CONFIG = 0x00000200,
59 ATH_DBG_FATAL = 0x00000400,
60 ATH_DBG_PS = 0x00000800,
61 ATH_DBG_HWTIMER = 0x00001000,
62 ATH_DBG_BTCOEX = 0x00002000,
63 ATH_DBG_WMI = 0x00004000,
64 ATH_DBG_BSTUCK = 0x00008000,
65 ATH_DBG_ANY = 0xffffffff
66};
67
68#define ATH_DBG_DEFAULT (ATH_DBG_FATAL)
69
70#ifdef CONFIG_ATH_DEBUG
71void ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...)
72 __attribute__ ((format (printf, 3, 4)));
73#define ATH_DBG_WARN(foo, arg...) WARN(foo, arg)
74#else
75static inline void __attribute__ ((format (printf, 3, 4)))
76ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...)
77{
78}
79#define ATH_DBG_WARN(foo, arg)
80#endif /* CONFIG_ATH_DEBUG */
81
82/** Returns string describing opmode, or NULL if unknown mode. */
83#ifdef CONFIG_ATH_DEBUG
84const char *ath_opmode_to_string(enum nl80211_iftype opmode);
85#else
86static inline const char *ath_opmode_to_string(enum nl80211_iftype opmode)
87{
88 return "UNKNOWN";
89}
90#endif
91 21
92#endif /* ATH_DEBUG_H */ 22#endif /* ATH_DEBUG_H */
diff --git a/drivers/net/wireless/ath/main.c b/drivers/net/wireless/ath/main.c
index 487193f1de1a..c325202fdc5f 100644
--- a/drivers/net/wireless/ath/main.c
+++ b/drivers/net/wireless/ath/main.c
@@ -56,3 +56,23 @@ struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
56 return skb; 56 return skb;
57} 57}
58EXPORT_SYMBOL(ath_rxbuf_alloc); 58EXPORT_SYMBOL(ath_rxbuf_alloc);
59
60int ath_printk(const char *level, struct ath_common *common,
61 const char *fmt, ...)
62{
63 struct va_format vaf;
64 va_list args;
65 int rtn;
66
67 va_start(args, fmt);
68
69 vaf.fmt = fmt;
70 vaf.va = &args;
71
72 rtn = printk("%sath: %pV", level, &vaf);
73
74 va_end(args);
75
76 return rtn;
77}
78EXPORT_SYMBOL(ath_printk);