diff options
Diffstat (limited to 'lib/dynamic_debug.c')
-rw-r--r-- | lib/dynamic_debug.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 7ca29a0a3019..29ff2e4cfb75 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
@@ -521,25 +521,25 @@ static char *dynamic_emit_prefix(const struct _ddebug *desc, char *buf) | |||
521 | int pos_after_tid; | 521 | int pos_after_tid; |
522 | int pos = 0; | 522 | int pos = 0; |
523 | 523 | ||
524 | pos += snprintf(buf + pos, remaining(pos), "%s", KERN_DEBUG); | 524 | *buf = '\0'; |
525 | |||
525 | if (desc->flags & _DPRINTK_FLAGS_INCL_TID) { | 526 | if (desc->flags & _DPRINTK_FLAGS_INCL_TID) { |
526 | if (in_interrupt()) | 527 | if (in_interrupt()) |
527 | pos += snprintf(buf + pos, remaining(pos), "%s ", | 528 | pos += snprintf(buf + pos, remaining(pos), "<intr> "); |
528 | "<intr>"); | ||
529 | else | 529 | else |
530 | pos += snprintf(buf + pos, remaining(pos), "[%d] ", | 530 | pos += snprintf(buf + pos, remaining(pos), "[%d] ", |
531 | task_pid_vnr(current)); | 531 | task_pid_vnr(current)); |
532 | } | 532 | } |
533 | pos_after_tid = pos; | 533 | pos_after_tid = pos; |
534 | if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME) | 534 | if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME) |
535 | pos += snprintf(buf + pos, remaining(pos), "%s:", | 535 | pos += snprintf(buf + pos, remaining(pos), "%s:", |
536 | desc->modname); | 536 | desc->modname); |
537 | if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) | 537 | if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) |
538 | pos += snprintf(buf + pos, remaining(pos), "%s:", | 538 | pos += snprintf(buf + pos, remaining(pos), "%s:", |
539 | desc->function); | 539 | desc->function); |
540 | if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO) | 540 | if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO) |
541 | pos += snprintf(buf + pos, remaining(pos), "%d:", | 541 | pos += snprintf(buf + pos, remaining(pos), "%d:", |
542 | desc->lineno); | 542 | desc->lineno); |
543 | if (pos - pos_after_tid) | 543 | if (pos - pos_after_tid) |
544 | pos += snprintf(buf + pos, remaining(pos), " "); | 544 | pos += snprintf(buf + pos, remaining(pos), " "); |
545 | if (pos >= PREFIX_SIZE) | 545 | if (pos >= PREFIX_SIZE) |
@@ -559,9 +559,13 @@ int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) | |||
559 | BUG_ON(!fmt); | 559 | BUG_ON(!fmt); |
560 | 560 | ||
561 | va_start(args, fmt); | 561 | va_start(args, fmt); |
562 | |||
562 | vaf.fmt = fmt; | 563 | vaf.fmt = fmt; |
563 | vaf.va = &args; | 564 | vaf.va = &args; |
564 | res = printk("%s%pV", dynamic_emit_prefix(descriptor, buf), &vaf); | 565 | |
566 | res = printk(KERN_DEBUG "%s%pV", | ||
567 | dynamic_emit_prefix(descriptor, buf), &vaf); | ||
568 | |||
565 | va_end(args); | 569 | va_end(args); |
566 | 570 | ||
567 | return res; | 571 | return res; |
@@ -574,15 +578,30 @@ int __dynamic_dev_dbg(struct _ddebug *descriptor, | |||
574 | struct va_format vaf; | 578 | struct va_format vaf; |
575 | va_list args; | 579 | va_list args; |
576 | int res; | 580 | int res; |
577 | char buf[PREFIX_SIZE]; | ||
578 | 581 | ||
579 | BUG_ON(!descriptor); | 582 | BUG_ON(!descriptor); |
580 | BUG_ON(!fmt); | 583 | BUG_ON(!fmt); |
581 | 584 | ||
582 | va_start(args, fmt); | 585 | va_start(args, fmt); |
586 | |||
583 | vaf.fmt = fmt; | 587 | vaf.fmt = fmt; |
584 | vaf.va = &args; | 588 | vaf.va = &args; |
585 | res = __dev_printk(dynamic_emit_prefix(descriptor, buf), dev, &vaf); | 589 | |
590 | if (!dev) { | ||
591 | res = printk(KERN_DEBUG "(NULL device *): %pV", &vaf); | ||
592 | } else { | ||
593 | char buf[PREFIX_SIZE]; | ||
594 | char dict[128]; | ||
595 | size_t dictlen; | ||
596 | |||
597 | dictlen = create_syslog_header(dev, dict, sizeof(dict)); | ||
598 | |||
599 | res = printk_emit(0, 7, dictlen ? dict : NULL, dictlen, | ||
600 | "%s%s %s: %pV", | ||
601 | dynamic_emit_prefix(descriptor, buf), | ||
602 | dev_driver_string(dev), dev_name(dev), &vaf); | ||
603 | } | ||
604 | |||
586 | va_end(args); | 605 | va_end(args); |
587 | 606 | ||
588 | return res; | 607 | return res; |