Thread (6 messages) 6 messages, 2 authors, 2012-11-14

Re: [RFC] dynamic_debug: introduce debug_hex_dump()

From: Joe Perches <joe@perches.com>
Date: 2012-11-14 13:41:06
Also in: lkml

On Wed, 2012-11-14 at 14:17 +0200, Vladimir Kondratiev wrote:
Introduce debug_hex_dump() that can be dynamically controlled, similar to
pr_debug.
(added Jason Baron, Jim Cromie, GregKH and lkml to cc's)

[]
quoted hunk ↗ jump to hunk
diff --git a/include/linux/printk.h b/include/linux/printk.h
[]
quoted hunk ↗ jump to hunk
@@ -220,6 +220,20 @@ extern void dump_stack(void) __cold;
 	no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #endifD
 
+#if defined(CONFIG_DYNAMIC_DEBUG)
+#define debug_hex_dump(prefix_str, prefix_type, rowsize,	\
+		       groupsize, buf, len, ascii)		\
+		       dynamic_hex_dump(prefix_str, prefix_type,\
+					rowsize, groupsize, buf,\
+					len, ascii)
+#else
+#define debug_hex_dump(prefix_str, prefix_type, rowsize,	\
+		       groupsize, buf, len, ascii)		\
+		       print_hex_dump(KERN_DEBUG, prefix_str,	\
+				      prefix_type, rowsize,	\
+				      groupsize, buf, len, ascii)
+#endif
These should be in a different location after print_hex_dump
is declared. Also for #defines, the indentation doesn't
need to be so deep.

#if defined(CONFIG_DYNAMIC_DEBUG)
#define debug_hex_dump(prefix_str, prefix_type, rowsize,	\
		       groupsize, buf, len, ascii)		\
	dynamic_hex_dump(prefix_str, prefix_type,		\
			 rowsize, groupsize, buf, len, ascii)
#else
#define debug_hex_dump(prefix_str, prefix_type, rowsize,	\
		       groupsize, buf, len, ascii)		\
	print_hex_dump(KERN_DEBUG, prefix_str, prefix_type,	\
		       rowsize, groupsize, buf, len, ascii)
#endif

A better option might be to convert print_hex_dump_bytes()
to dynamic_debug as that's already KERN_DEBUG.  That
could be simpler overall and it makes existing calls
become dynamic as well.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help