aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dynamic_debug.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-08-11 14:36:21 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-22 21:23:04 -0400
commitcbc4663552ee476f57933920d782222d94878e7e (patch)
tree7fa60ec28e53114d239137b7cea65c66da15040c /lib/dynamic_debug.c
parent25b8a88c10770e8c3f14bf2e222691dc6e79de78 (diff)
dynamic_debug: Add __dynamic_dev_dbg
Unlike dynamic_pr_debug, dynamic uses of dev_dbg can not currently add task_pid/KBUILD_MODNAME/__func__/__LINE__ to selected debug output. Add a new function similar to dynamic_pr_debug to optionally emit these prefixes. Cc: Aloisio Almeida <aloisio.almeida@openbossa.org> Noticed-by: Aloisio Almeida <aloisio.almeida@openbossa.org> Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jason Baron <jbaron@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib/dynamic_debug.c')
-rw-r--r--lib/dynamic_debug.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 75ca78f3a8c9..63b6f95ac552 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -30,6 +30,7 @@
30#include <linux/jump_label.h> 30#include <linux/jump_label.h>
31#include <linux/hardirq.h> 31#include <linux/hardirq.h>
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/device.h>
33 34
34extern struct _ddebug __start___verbose[]; 35extern struct _ddebug __start___verbose[];
35extern struct _ddebug __stop___verbose[]; 36extern struct _ddebug __stop___verbose[];
@@ -456,6 +457,43 @@ int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
456} 457}
457EXPORT_SYMBOL(__dynamic_pr_debug); 458EXPORT_SYMBOL(__dynamic_pr_debug);
458 459
460int __dynamic_dev_dbg(struct _ddebug *descriptor,
461 const struct device *dev, const char *fmt, ...)
462{
463 struct va_format vaf;
464 va_list args;
465 int res;
466
467 BUG_ON(!descriptor);
468 BUG_ON(!fmt);
469
470 va_start(args, fmt);
471
472 vaf.fmt = fmt;
473 vaf.va = &args;
474
475 res = printk(KERN_DEBUG);
476 if (descriptor->flags & _DPRINTK_FLAGS_INCL_TID) {
477 if (in_interrupt())
478 res += printk(KERN_CONT "<intr> ");
479 else
480 res += printk(KERN_CONT "[%d] ", task_pid_vnr(current));
481 }
482 if (descriptor->flags & _DPRINTK_FLAGS_INCL_MODNAME)
483 res += printk(KERN_CONT "%s:", descriptor->modname);
484 if (descriptor->flags & _DPRINTK_FLAGS_INCL_FUNCNAME)
485 res += printk(KERN_CONT "%s:", descriptor->function);
486 if (descriptor->flags & _DPRINTK_FLAGS_INCL_LINENO)
487 res += printk(KERN_CONT "%d ", descriptor->lineno);
488
489 res += __dev_printk(KERN_CONT, dev, &vaf);
490
491 va_end(args);
492
493 return res;
494}
495EXPORT_SYMBOL(__dynamic_dev_dbg);
496
459static __initdata char ddebug_setup_string[1024]; 497static __initdata char ddebug_setup_string[1024];
460static __init int ddebug_setup_query(char *str) 498static __init int ddebug_setup_query(char *str)
461{ 499{