diff options
author | Holger Schurig <hs4233@mail.mn-solutions.de> | 2007-05-25 11:27:16 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-06-11 14:28:37 -0400 |
commit | 9012b28a407511fb355f6d2176a12d4653489672 (patch) | |
tree | 771b0f7adb9dbab5c907981bd4fa3a7f6219587d /drivers/net/wireless/libertas/defs.h | |
parent | 46868202b2dd22156460a220553a223f406f4f22 (diff) |
[PATCH] libertas: make debug configurable
The debug output of libertas was either not present or it was overwhelming.
This patch adds the possibility to specify a bitmask for the area of
interest. One should then only get the desired output.
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/defs.h')
-rw-r--r-- | drivers/net/wireless/libertas/defs.h | 87 |
1 files changed, 69 insertions, 18 deletions
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index cd95977cf89a..ae59b37fd47f 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h | |||
@@ -7,14 +7,77 @@ | |||
7 | 7 | ||
8 | #include <linux/spinlock.h> | 8 | #include <linux/spinlock.h> |
9 | 9 | ||
10 | extern unsigned int libertas_debug; | ||
11 | |||
12 | #ifdef CONFIG_LIBERTAS_DEBUG | 10 | #ifdef CONFIG_LIBERTAS_DEBUG |
13 | #define DEBUG | 11 | #define DEBUG |
14 | #define PROC_DEBUG | 12 | #define PROC_DEBUG |
15 | #endif | 13 | #endif |
16 | 14 | ||
17 | #define DRV_NAME "usb8xxx" | 15 | #define DRV_NAME "usb8xxx" |
16 | |||
17 | |||
18 | #define LBS_DEB_ENTER (1<<0) | ||
19 | #define LBS_DEB_LEAVE (1<<1) | ||
20 | #define LBS_DEB_MAIN (1<<2) | ||
21 | #define LBS_DEB_NET (1<<3) | ||
22 | #define LBS_DEB_MESH (1<<4) | ||
23 | #define LBS_DEB_WEXT (1<<5) | ||
24 | #define LBS_DEB_IOCTL (1<<6) | ||
25 | #define LBS_DEB_SCAN (1<<7) | ||
26 | #define LBS_DEB_ASSOC (1<<8) | ||
27 | #define LBS_DEB_JOIN (1<<9) | ||
28 | #define LBS_DEB_11D (1<<10) | ||
29 | #define LBS_DEB_DEBUGFS (1<<11) | ||
30 | #define LBS_DEB_ETHTOOL (1<<12) | ||
31 | #define LBS_DEB_HOST (1<<13) | ||
32 | #define LBS_DEB_CMD (1<<14) | ||
33 | #define LBS_DEB_RX (1<<15) | ||
34 | #define LBS_DEB_TX (1<<16) | ||
35 | #define LBS_DEB_FW (1<<17) | ||
36 | #define LBS_DEB_USB (1<<18) | ||
37 | #define LBS_DEB_CS (1<<19) | ||
38 | #define LBS_DEB_THREAD (1<<20) | ||
39 | #define LBS_DEB_HEX (1<<21) | ||
40 | |||
41 | extern unsigned int libertas_debug_flags; | ||
42 | |||
43 | #ifdef DEBUG | ||
44 | #define LBS_DEB_LL(grp, fmt, args...) \ | ||
45 | do { if ((libertas_debug_flags & (grp)) == (grp)) \ | ||
46 | printk(KERN_DEBUG DRV_NAME "%s: " fmt, \ | ||
47 | in_interrupt() ? " (INT)" : "", ## args); } while (0) | ||
48 | #else | ||
49 | #define LBS_DEB_LL(grp, fmt, args...) do {} while (0) | ||
50 | #endif | ||
51 | |||
52 | #define lbs_deb_enter(grp) \ | ||
53 | LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s() %d enter\n", __FUNCTION__, __LINE__); | ||
54 | #define lbs_deb_enter_args(grp, fmt, args...) \ | ||
55 | LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s(" fmt "):%d\n", __FUNCTION__, ## args, __LINE__); | ||
56 | #define lbs_deb_leave(grp) \ | ||
57 | LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave\n", __FUNCTION__, __LINE__); | ||
58 | #define lbs_deb_leave_args(grp, fmt, args...) \ | ||
59 | LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave, " fmt "\n", \ | ||
60 | __FUNCTION__, __LINE__, ##args); | ||
61 | #define lbs_deb_main(fmt, args...) LBS_DEB_LL(LBS_DEB_MAIN, fmt, ##args) | ||
62 | #define lbs_deb_net(fmt, args...) LBS_DEB_LL(LBS_DEB_NET, fmt, ##args) | ||
63 | #define lbs_deb_mesh(fmt, args...) LBS_DEB_LL(LBS_DEB_MESH, fmt, ##args) | ||
64 | #define lbs_deb_wext(fmt, args...) LBS_DEB_LL(LBS_DEB_WEXT, fmt, ##args) | ||
65 | #define lbs_deb_ioctl(fmt, args...) LBS_DEB_LL(LBS_DEB_IOCTL, fmt, ##args) | ||
66 | #define lbs_deb_scan(fmt, args...) LBS_DEB_LL(LBS_DEB_SCAN, fmt, ##args) | ||
67 | #define lbs_deb_assoc(fmt, args...) LBS_DEB_LL(LBS_DEB_ASSOC, fmt, ##args) | ||
68 | #define lbs_deb_join(fmt, args...) LBS_DEB_LL(LBS_DEB_JOIN, fmt, ##args) | ||
69 | #define lbs_deb_11d(fmt, args...) LBS_DEB_LL(LBS_DEB_11D, fmt, ##args) | ||
70 | #define lbs_deb_debugfs(fmt, args...) LBS_DEB_LL(LBS_DEB_DEBUGFS, fmt, ##args) | ||
71 | #define lbs_deb_ethtool(fmt, args...) LBS_DEB_LL(LBS_DEB_ETHTOOL, fmt, ##args) | ||
72 | #define lbs_deb_host(fmt, args...) LBS_DEB_LL(LBS_DEB_HOST, fmt, ##args) | ||
73 | #define lbs_deb_cmd(fmt, args...) LBS_DEB_LL(LBS_DEB_CMD, fmt, ##args) | ||
74 | #define lbs_deb_rx(fmt, args...) LBS_DEB_LL(LBS_DEB_RX, fmt, ##args) | ||
75 | #define lbs_deb_tx(fmt, args...) LBS_DEB_LL(LBS_DEB_TX, fmt, ##args) | ||
76 | #define lbs_deb_fw(fmt, args...) LBS_DEB_LL(LBS_DEB_FW, fmt, ##args) | ||
77 | #define lbs_deb_usb(fmt, args...) LBS_DEB_LL(LBS_DEB_USB, fmt, ##args) | ||
78 | #define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, "%s:" fmt, (dev)->bus_id, ##args) | ||
79 | #define lbs_deb_cs(fmt, args...) LBS_DEB_LL(LBS_DEB_CS, fmt, ##args) | ||
80 | #define lbs_deb_thread(fmt, args...) LBS_DEB_LL(LBS_DEB_THREAD, fmt, ##args) | ||
18 | 81 | ||
19 | #define lbs_pr_info(format, args...) \ | 82 | #define lbs_pr_info(format, args...) \ |
20 | printk(KERN_INFO DRV_NAME": " format, ## args) | 83 | printk(KERN_INFO DRV_NAME": " format, ## args) |
@@ -24,37 +87,25 @@ extern unsigned int libertas_debug; | |||
24 | printk(KERN_ALERT DRV_NAME": " format, ## args) | 87 | printk(KERN_ALERT DRV_NAME": " format, ## args) |
25 | 88 | ||
26 | #ifdef DEBUG | 89 | #ifdef DEBUG |
27 | #define lbs_pr_debug(level, format, args...) \ | ||
28 | do { if (libertas_debug >= level) \ | ||
29 | printk(KERN_INFO DRV_NAME": " format, ##args); } while (0) | ||
30 | #define lbs_dev_dbg(level, device, format, args...) \ | ||
31 | lbs_pr_debug(level, "%s: " format, \ | ||
32 | (device)->bus_id , ## args) | ||
33 | |||
34 | static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len) | 90 | static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len) |
35 | { | 91 | { |
36 | int i = 0; | 92 | int i = 0; |
37 | 93 | ||
38 | if (!libertas_debug) | 94 | if (!(libertas_debug_flags & LBS_DEB_HEX)) |
39 | return; | 95 | return; |
40 | 96 | ||
41 | printk(KERN_DEBUG "%s: ", prompt); | 97 | printk(KERN_DEBUG "%s: ", prompt); |
42 | for (i = 1; i <= len; i++) { | 98 | for (i = 1; i <= len; i++) { |
43 | printk(KERN_DEBUG "%02x ", (u8) * buf); | 99 | printk("%02x ", (u8) * buf); |
44 | buf++; | 100 | buf++; |
45 | } | 101 | } |
46 | printk("\n"); | 102 | printk("\n"); |
47 | } | 103 | } |
48 | #else | 104 | #else |
49 | #define lbs_pr_debug(level, format, args...) do {} while (0) | ||
50 | #define lbs_dev_dbg(level, device, format, args...) do {} while (0) | ||
51 | #define lbs_dbg_hex(x,y,z) do {} while (0) | 105 | #define lbs_dbg_hex(x,y,z) do {} while (0) |
52 | #endif | 106 | #endif |
53 | 107 | ||
54 | #define ENTER() lbs_pr_debug(1, "Enter: %s:%i\n", \ | 108 | |
55 | __FUNCTION__, __LINE__) | ||
56 | #define LEAVE() lbs_pr_debug(1, "Leave: %s:%i\n", \ | ||
57 | __FUNCTION__, __LINE__) | ||
58 | 109 | ||
59 | /** Buffer Constants */ | 110 | /** Buffer Constants */ |
60 | 111 | ||