diff options
author | Joe Perches <joe@perches.com> | 2011-08-11 14:36:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-22 21:23:04 -0400 |
commit | 6c2140ee0ebf91258f93d3019922b5f520a18d88 (patch) | |
tree | 69355a873ffa0632e192fafea92158d5259738c5 /lib/dynamic_debug.c | |
parent | cbc4663552ee476f57933920d782222d94878e7e (diff) |
dynamic_debug: Consolidate prefix output to single routine
Adding dynamic_dev_dbg duplicated prefix output.
Consolidate that output to a single routine.
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.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 63b6f95ac552..37217090aacf 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
@@ -428,15 +428,10 @@ static int ddebug_exec_query(char *query_string) | |||
428 | return 0; | 428 | return 0; |
429 | } | 429 | } |
430 | 430 | ||
431 | int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) | 431 | static int dynamic_emit_prefix(const struct _ddebug *descriptor) |
432 | { | 432 | { |
433 | va_list args; | ||
434 | int res; | 433 | int res; |
435 | 434 | ||
436 | BUG_ON(!descriptor); | ||
437 | BUG_ON(!fmt); | ||
438 | |||
439 | va_start(args, fmt); | ||
440 | res = printk(KERN_DEBUG); | 435 | res = printk(KERN_DEBUG); |
441 | if (descriptor->flags & _DPRINTK_FLAGS_INCL_TID) { | 436 | if (descriptor->flags & _DPRINTK_FLAGS_INCL_TID) { |
442 | if (in_interrupt()) | 437 | if (in_interrupt()) |
@@ -450,7 +445,23 @@ int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) | |||
450 | res += printk(KERN_CONT "%s:", descriptor->function); | 445 | res += printk(KERN_CONT "%s:", descriptor->function); |
451 | if (descriptor->flags & _DPRINTK_FLAGS_INCL_LINENO) | 446 | if (descriptor->flags & _DPRINTK_FLAGS_INCL_LINENO) |
452 | res += printk(KERN_CONT "%d ", descriptor->lineno); | 447 | res += printk(KERN_CONT "%d ", descriptor->lineno); |
448 | |||
449 | return res; | ||
450 | } | ||
451 | |||
452 | int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) | ||
453 | { | ||
454 | va_list args; | ||
455 | int res; | ||
456 | |||
457 | BUG_ON(!descriptor); | ||
458 | BUG_ON(!fmt); | ||
459 | |||
460 | va_start(args, fmt); | ||
461 | |||
462 | res = dynamic_emit_prefix(descriptor); | ||
453 | res += vprintk(fmt, args); | 463 | res += vprintk(fmt, args); |
464 | |||
454 | va_end(args); | 465 | va_end(args); |
455 | 466 | ||
456 | return res; | 467 | return res; |
@@ -472,20 +483,7 @@ int __dynamic_dev_dbg(struct _ddebug *descriptor, | |||
472 | vaf.fmt = fmt; | 483 | vaf.fmt = fmt; |
473 | vaf.va = &args; | 484 | vaf.va = &args; |
474 | 485 | ||
475 | res = printk(KERN_DEBUG); | 486 | res = dynamic_emit_prefix(descriptor); |
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); | 487 | res += __dev_printk(KERN_CONT, dev, &vaf); |
490 | 488 | ||
491 | va_end(args); | 489 | va_end(args); |