aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/hisax_debug.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/isdn/hisax/hisax_debug.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/isdn/hisax/hisax_debug.h')
-rw-r--r--drivers/isdn/hisax/hisax_debug.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/drivers/isdn/hisax/hisax_debug.h b/drivers/isdn/hisax/hisax_debug.h
new file mode 100644
index 000000000000..ba518a7a7fb7
--- /dev/null
+++ b/drivers/isdn/hisax/hisax_debug.h
@@ -0,0 +1,81 @@
1/*
2 * Common debugging macros for use with the hisax driver
3 *
4 * Author Frode Isaksen
5 * Copyright 2001 by Frode Isaksen <fisaksen@bewan.com>
6 * 2001 by Kai Germaschewski <kai.germaschewski@gmx.de>
7 *
8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference.
10 *
11 * How to use:
12 *
13 * Before including this file, you need to
14 * #define __debug_variable my_debug
15 * where my_debug is a variable in your code which
16 * determines the debug bitmask.
17 *
18 * If CONFIG_HISAX_DEBUG is not set, all macros evaluate to nothing
19 *
20 */
21
22#ifndef __HISAX_DEBUG_H__
23#define __HISAX_DEBUG_H__
24
25#include <linux/config.h>
26
27#ifdef CONFIG_HISAX_DEBUG
28
29#define DBG(level, format, arg...) do { \
30if (level & __debug_variable) \
31printk(KERN_DEBUG "%s: " format "\n" , __FUNCTION__ , ## arg); \
32} while (0)
33
34#define DBG_PACKET(level,data,count) \
35 if (level & __debug_variable) dump_packet(__FUNCTION__,data,count)
36
37#define DBG_SKB(level,skb) \
38 if ((level & __debug_variable) && skb) dump_packet(__FUNCTION__,skb->data,skb->len)
39
40
41static void __attribute__((unused))
42dump_packet(const char *name,const u_char *data,int pkt_len)
43{
44#define DUMP_HDR_SIZE 20
45#define DUMP_TLR_SIZE 8
46 if (pkt_len) {
47 int i,len1,len2;
48
49 printk(KERN_DEBUG "%s: length=%d,data=",name,pkt_len);
50
51 if (pkt_len > DUMP_HDR_SIZE+ DUMP_TLR_SIZE) {
52 len1 = DUMP_HDR_SIZE;
53 len2 = DUMP_TLR_SIZE;
54 } else {
55 len1 = pkt_len > DUMP_HDR_SIZE ? DUMP_HDR_SIZE : pkt_len;
56 len2 = 0;
57 }
58 for (i = 0; i < len1; ++i) {
59 printk ("%.2x", data[i]);
60 }
61 if (len2) {
62 printk ("..");
63 for (i = pkt_len-DUMP_TLR_SIZE; i < pkt_len; ++i) {
64 printk ("%.2x", data[i]);
65 }
66 }
67 printk ("\n");
68 }
69#undef DUMP_HDR_SIZE
70#undef DUMP_TLR_SIZE
71}
72
73#else
74
75#define DBG(level, format, arg...) do {} while (0)
76#define DBG_PACKET(level,data,count) do {} while (0)
77#define DBG_SKB(level,skb) do {} while (0)
78
79#endif
80
81#endif