summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/isdn/hisax/hisax_debug.h
diff options
context:
space:
mode:
authorYunhong Jiang <yunhong.jiang@intel.com>2015-08-04 12:17:53 -0700
committerYunhong Jiang <yunhong.jiang@intel.com>2015-08-04 15:44:42 -0700
commit9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (patch)
tree1c9cafbcd35f783a87880a10f85d1a060db1a563 /kernel/drivers/isdn/hisax/hisax_debug.h
parent98260f3884f4a202f9ca5eabed40b1354c489b29 (diff)
Add the rt linux 4.1.3-rt3 as base
Import the rt linux 4.1.3-rt3 as OPNFV kvm base. It's from git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt and the base is: commit 0917f823c59692d751951bf5ea699a2d1e2f26a2 Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Date: Sat Jul 25 12:13:34 2015 +0200 Prepare v4.1.3-rt3 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> We lose all the git history this way and it's not good. We should apply another opnfv project repo in future. Change-Id: I87543d81c9df70d99c5001fbdf646b202c19f423 Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Diffstat (limited to 'kernel/drivers/isdn/hisax/hisax_debug.h')
-rw-r--r--kernel/drivers/isdn/hisax/hisax_debug.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/kernel/drivers/isdn/hisax/hisax_debug.h b/kernel/drivers/isdn/hisax/hisax_debug.h
new file mode 100644
index 000000000..7b3093d08
--- /dev/null
+++ b/kernel/drivers/isdn/hisax/hisax_debug.h
@@ -0,0 +1,80 @@
+/*
+ * Common debugging macros for use with the hisax driver
+ *
+ * Author Frode Isaksen
+ * Copyright 2001 by Frode Isaksen <fisaksen@bewan.com>
+ * 2001 by Kai Germaschewski <kai.germaschewski@gmx.de>
+ *
+ * This software may be used and distributed according to the terms
+ * of the GNU General Public License, incorporated herein by reference.
+ *
+ * How to use:
+ *
+ * Before including this file, you need to
+ * #define __debug_variable my_debug
+ * where my_debug is a variable in your code which
+ * determines the debug bitmask.
+ *
+ * If CONFIG_HISAX_DEBUG is not set, all macros evaluate to nothing
+ *
+ */
+
+#ifndef __HISAX_DEBUG_H__
+#define __HISAX_DEBUG_H__
+
+
+#ifdef CONFIG_HISAX_DEBUG
+
+#define DBG(level, format, arg...) do { \
+ if (level & __debug_variable) \
+ printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \
+ } while (0)
+
+#define DBG_PACKET(level, data, count) \
+ if (level & __debug_variable) dump_packet(__func__, data, count)
+
+#define DBG_SKB(level, skb) \
+ if ((level & __debug_variable) && skb) dump_packet(__func__, skb->data, skb->len)
+
+
+static void __attribute__((unused))
+dump_packet(const char *name, const u_char *data, int pkt_len)
+{
+#define DUMP_HDR_SIZE 20
+#define DUMP_TLR_SIZE 8
+ if (pkt_len) {
+ int i, len1, len2;
+
+ printk(KERN_DEBUG "%s: length=%d,data=", name, pkt_len);
+
+ if (pkt_len > DUMP_HDR_SIZE + DUMP_TLR_SIZE) {
+ len1 = DUMP_HDR_SIZE;
+ len2 = DUMP_TLR_SIZE;
+ } else {
+ len1 = pkt_len > DUMP_HDR_SIZE ? DUMP_HDR_SIZE : pkt_len;
+ len2 = 0;
+ }
+ for (i = 0; i < len1; ++i) {
+ printk("%.2x", data[i]);
+ }
+ if (len2) {
+ printk("..");
+ for (i = pkt_len-DUMP_TLR_SIZE; i < pkt_len; ++i) {
+ printk("%.2x", data[i]);
+ }
+ }
+ printk("\n");
+ }
+#undef DUMP_HDR_SIZE
+#undef DUMP_TLR_SIZE
+}
+
+#else
+
+#define DBG(level, format, arg...) do {} while (0)
+#define DBG_PACKET(level, data, count) do {} while (0)
+#define DBG_SKB(level, skb) do {} while (0)
+
+#endif
+
+#endif