diff options
author | Holger Schurig <hs4233@mail.mn-solutions.de> | 2007-08-02 11:53:06 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:49:53 -0400 |
commit | ece561919326236c7fb791a5e883f0eb76af029e (patch) | |
tree | 69d81daf8f8de4182ca89ab3b722defc585ffa80 /drivers/net/wireless/libertas/defs.h | |
parent | a9f38d023b65c9fe2602303c1101c868be4fcbcc (diff) |
[PATCH] libertas: make the hex dumper nicer
Currently, when you define LBS_DEB_HEX, you get every hex dump in the
whole driver, e.g. for LBS_DEB_CMD, LBS_DEB_RX, LBS_DEB_TX etc. This
patch makes sure that you only get the hexdump that you're interested in.
Renamed lbs_dbg_hex() into lbs_deb_hex(), like the other lbs_deb_XXX()
macros.
Made lbs_deb_hex() issue a line feed (and a new prompt) after 16 bytes.
As lbs_deb_hex() now prints the ":" after the prompt by itself, removed
the misc colons in the various *.c files.
lbs_deb_XXX() now print the debug category as well.
As lbs_deb_XXX() --- and especially lbs_deb_11d() --- now print the
category, I removed various "11D:" prefixes in 11d.c as well.
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 | 80 |
1 files changed, 43 insertions, 37 deletions
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index e47fadf3722..7c5b7f7b45d 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h | |||
@@ -43,43 +43,43 @@ | |||
43 | extern unsigned int libertas_debug; | 43 | extern unsigned int libertas_debug; |
44 | 44 | ||
45 | #ifdef DEBUG | 45 | #ifdef DEBUG |
46 | #define LBS_DEB_LL(grp, fmt, args...) \ | 46 | #define LBS_DEB_LL(grp, grpnam, fmt, args...) \ |
47 | do { if ((libertas_debug & (grp)) == (grp)) \ | 47 | do { if ((libertas_debug & (grp)) == (grp)) \ |
48 | printk(KERN_DEBUG DRV_NAME "%s: " fmt, \ | 48 | printk(KERN_DEBUG DRV_NAME grpnam "%s: " fmt, \ |
49 | in_interrupt() ? " (INT)" : "", ## args); } while (0) | 49 | in_interrupt() ? " (INT)" : "", ## args); } while (0) |
50 | #else | 50 | #else |
51 | #define LBS_DEB_LL(grp, fmt, args...) do {} while (0) | 51 | #define LBS_DEB_LL(grp, grpnam, fmt, args...) do {} while (0) |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #define lbs_deb_enter(grp) \ | 54 | #define lbs_deb_enter(grp) \ |
55 | LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s():%d enter\n", __FUNCTION__, __LINE__); | 55 | LBS_DEB_LL(grp | LBS_DEB_ENTER, " enter", "%s():%d\n", __FUNCTION__, __LINE__); |
56 | #define lbs_deb_enter_args(grp, fmt, args...) \ | 56 | #define lbs_deb_enter_args(grp, fmt, args...) \ |
57 | LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s(" fmt "):%d\n", __FUNCTION__, ## args, __LINE__); | 57 | LBS_DEB_LL(grp | LBS_DEB_ENTER, " enter", "%s(" fmt "):%d\n", __FUNCTION__, ## args, __LINE__); |
58 | #define lbs_deb_leave(grp) \ | 58 | #define lbs_deb_leave(grp) \ |
59 | LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave\n", __FUNCTION__, __LINE__); | 59 | LBS_DEB_LL(grp | LBS_DEB_LEAVE, " leave", "%s():%d\n", __FUNCTION__, __LINE__); |
60 | #define lbs_deb_leave_args(grp, fmt, args...) \ | 60 | #define lbs_deb_leave_args(grp, fmt, args...) \ |
61 | LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave, " fmt "\n", \ | 61 | LBS_DEB_LL(grp | LBS_DEB_LEAVE, " leave", "%s():%d, " fmt "\n", \ |
62 | __FUNCTION__, __LINE__, ##args); | 62 | __FUNCTION__, __LINE__, ##args); |
63 | #define lbs_deb_main(fmt, args...) LBS_DEB_LL(LBS_DEB_MAIN, fmt, ##args) | 63 | #define lbs_deb_main(fmt, args...) LBS_DEB_LL(LBS_DEB_MAIN, " main", fmt, ##args) |
64 | #define lbs_deb_net(fmt, args...) LBS_DEB_LL(LBS_DEB_NET, fmt, ##args) | 64 | #define lbs_deb_net(fmt, args...) LBS_DEB_LL(LBS_DEB_NET, " net", fmt, ##args) |
65 | #define lbs_deb_mesh(fmt, args...) LBS_DEB_LL(LBS_DEB_MESH, fmt, ##args) | 65 | #define lbs_deb_mesh(fmt, args...) LBS_DEB_LL(LBS_DEB_MESH, " mesh", fmt, ##args) |
66 | #define lbs_deb_wext(fmt, args...) LBS_DEB_LL(LBS_DEB_WEXT, fmt, ##args) | 66 | #define lbs_deb_wext(fmt, args...) LBS_DEB_LL(LBS_DEB_WEXT, " wext", fmt, ##args) |
67 | #define lbs_deb_ioctl(fmt, args...) LBS_DEB_LL(LBS_DEB_IOCTL, fmt, ##args) | 67 | #define lbs_deb_ioctl(fmt, args...) LBS_DEB_LL(LBS_DEB_IOCTL, " ioctl", fmt, ##args) |
68 | #define lbs_deb_scan(fmt, args...) LBS_DEB_LL(LBS_DEB_SCAN, fmt, ##args) | 68 | #define lbs_deb_scan(fmt, args...) LBS_DEB_LL(LBS_DEB_SCAN, " scan", fmt, ##args) |
69 | #define lbs_deb_assoc(fmt, args...) LBS_DEB_LL(LBS_DEB_ASSOC, fmt, ##args) | 69 | #define lbs_deb_assoc(fmt, args...) LBS_DEB_LL(LBS_DEB_ASSOC, " assoc", fmt, ##args) |
70 | #define lbs_deb_join(fmt, args...) LBS_DEB_LL(LBS_DEB_JOIN, fmt, ##args) | 70 | #define lbs_deb_join(fmt, args...) LBS_DEB_LL(LBS_DEB_JOIN, " join", fmt, ##args) |
71 | #define lbs_deb_11d(fmt, args...) LBS_DEB_LL(LBS_DEB_11D, fmt, ##args) | 71 | #define lbs_deb_11d(fmt, args...) LBS_DEB_LL(LBS_DEB_11D, " 11d", fmt, ##args) |
72 | #define lbs_deb_debugfs(fmt, args...) LBS_DEB_LL(LBS_DEB_DEBUGFS, fmt, ##args) | 72 | #define lbs_deb_debugfs(fmt, args...) LBS_DEB_LL(LBS_DEB_DEBUGFS, " debugfs", fmt, ##args) |
73 | #define lbs_deb_ethtool(fmt, args...) LBS_DEB_LL(LBS_DEB_ETHTOOL, fmt, ##args) | 73 | #define lbs_deb_ethtool(fmt, args...) LBS_DEB_LL(LBS_DEB_ETHTOOL, " ethtool", fmt, ##args) |
74 | #define lbs_deb_host(fmt, args...) LBS_DEB_LL(LBS_DEB_HOST, fmt, ##args) | 74 | #define lbs_deb_host(fmt, args...) LBS_DEB_LL(LBS_DEB_HOST, " host", fmt, ##args) |
75 | #define lbs_deb_cmd(fmt, args...) LBS_DEB_LL(LBS_DEB_CMD, fmt, ##args) | 75 | #define lbs_deb_cmd(fmt, args...) LBS_DEB_LL(LBS_DEB_CMD, " cmd", fmt, ##args) |
76 | #define lbs_deb_rx(fmt, args...) LBS_DEB_LL(LBS_DEB_RX, fmt, ##args) | 76 | #define lbs_deb_rx(fmt, args...) LBS_DEB_LL(LBS_DEB_RX, " rx", fmt, ##args) |
77 | #define lbs_deb_tx(fmt, args...) LBS_DEB_LL(LBS_DEB_TX, fmt, ##args) | 77 | #define lbs_deb_tx(fmt, args...) LBS_DEB_LL(LBS_DEB_TX, " tx", fmt, ##args) |
78 | #define lbs_deb_fw(fmt, args...) LBS_DEB_LL(LBS_DEB_FW, fmt, ##args) | 78 | #define lbs_deb_fw(fmt, args...) LBS_DEB_LL(LBS_DEB_FW, " fw", fmt, ##args) |
79 | #define lbs_deb_usb(fmt, args...) LBS_DEB_LL(LBS_DEB_USB, fmt, ##args) | 79 | #define lbs_deb_usb(fmt, args...) LBS_DEB_LL(LBS_DEB_USB, " usb", fmt, ##args) |
80 | #define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, "%s:" fmt, (dev)->bus_id, ##args) | 80 | #define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, " usbd", "%s:" fmt, (dev)->bus_id, ##args) |
81 | #define lbs_deb_cs(fmt, args...) LBS_DEB_LL(LBS_DEB_CS, fmt, ##args) | 81 | #define lbs_deb_cs(fmt, args...) LBS_DEB_LL(LBS_DEB_CS, " cs", fmt, ##args) |
82 | #define lbs_deb_thread(fmt, args...) LBS_DEB_LL(LBS_DEB_THREAD, fmt, ##args) | 82 | #define lbs_deb_thread(fmt, args...) LBS_DEB_LL(LBS_DEB_THREAD, " thread", fmt, ##args) |
83 | 83 | ||
84 | #define lbs_pr_info(format, args...) \ | 84 | #define lbs_pr_info(format, args...) \ |
85 | printk(KERN_INFO DRV_NAME": " format, ## args) | 85 | printk(KERN_INFO DRV_NAME": " format, ## args) |
@@ -89,22 +89,28 @@ do { if ((libertas_debug & (grp)) == (grp)) \ | |||
89 | printk(KERN_ALERT DRV_NAME": " format, ## args) | 89 | printk(KERN_ALERT DRV_NAME": " format, ## args) |
90 | 90 | ||
91 | #ifdef DEBUG | 91 | #ifdef DEBUG |
92 | static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len) | 92 | static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len) |
93 | { | 93 | { |
94 | int i = 0; | 94 | int i = 0; |
95 | 95 | ||
96 | if (!(libertas_debug & LBS_DEB_HEX)) | 96 | if (len && |
97 | return; | 97 | (libertas_debug & LBS_DEB_HEX) && |
98 | 98 | (libertas_debug & grp)) | |
99 | printk(KERN_DEBUG "%s: ", prompt); | 99 | { |
100 | for (i = 1; i <= len; i++) { | 100 | for (i = 1; i <= len; i++) { |
101 | printk("%02x ", (u8) * buf); | 101 | if ((i & 0xf) == 1) { |
102 | buf++; | 102 | if (i != 1) |
103 | printk("\n"); | ||
104 | printk(DRV_NAME " %s: ", prompt); | ||
105 | } | ||
106 | printk("%02x ", (u8) * buf); | ||
107 | buf++; | ||
108 | } | ||
109 | printk("\n"); | ||
103 | } | 110 | } |
104 | printk("\n"); | ||
105 | } | 111 | } |
106 | #else | 112 | #else |
107 | #define lbs_dbg_hex(x,y,z) do {} while (0) | 113 | #define lbs_deb_hex(grp,prompt,buf,len) do {} while (0) |
108 | #endif | 114 | #endif |
109 | 115 | ||
110 | 116 | ||