aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/dynamic_debug.c38
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
431int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) 431static 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
452int __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);