diff options
Diffstat (limited to 'init/main.c')
-rw-r--r-- | init/main.c | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/init/main.c b/init/main.c index ddada7acf363..f7fb20021d48 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -693,55 +693,57 @@ static int __init initcall_debug_setup(char *str) | |||
693 | } | 693 | } |
694 | __setup("initcall_debug", initcall_debug_setup); | 694 | __setup("initcall_debug", initcall_debug_setup); |
695 | 695 | ||
696 | extern initcall_t __initcall_start[], __initcall_end[]; | 696 | static void __init do_one_initcall(initcall_t fn) |
697 | |||
698 | static void __init do_initcalls(void) | ||
699 | { | 697 | { |
700 | initcall_t *call; | ||
701 | int count = preempt_count(); | 698 | int count = preempt_count(); |
699 | ktime_t t0, t1, delta; | ||
700 | char msgbuf[64]; | ||
701 | int result; | ||
702 | 702 | ||
703 | for (call = __initcall_start; call < __initcall_end; call++) { | 703 | if (initcall_debug) { |
704 | ktime_t t0, t1, delta; | 704 | print_fn_descriptor_symbol("calling %s\n", fn); |
705 | char *msg = NULL; | 705 | t0 = ktime_get(); |
706 | char msgbuf[40]; | 706 | } |
707 | int result; | ||
708 | 707 | ||
709 | if (initcall_debug) { | 708 | result = fn(); |
710 | print_fn_descriptor_symbol("calling %s()\n", | ||
711 | (unsigned long) *call); | ||
712 | t0 = ktime_get(); | ||
713 | } | ||
714 | 709 | ||
715 | result = (*call)(); | 710 | if (initcall_debug) { |
711 | t1 = ktime_get(); | ||
712 | delta = ktime_sub(t1, t0); | ||
716 | 713 | ||
717 | if (initcall_debug) { | 714 | print_fn_descriptor_symbol("initcall %s", fn); |
718 | t1 = ktime_get(); | 715 | printk(" returned %d after %Ld msecs\n", result, |
719 | delta = ktime_sub(t1, t0); | 716 | (unsigned long long) delta.tv64 >> 20); |
717 | } | ||
720 | 718 | ||
721 | print_fn_descriptor_symbol("initcall %s()", | 719 | msgbuf[0] = 0; |
722 | (unsigned long) *call); | ||
723 | printk(" returned %d after %Ld msecs\n", result, | ||
724 | (unsigned long long) delta.tv64 >> 20); | ||
725 | } | ||
726 | 720 | ||
727 | if (result && result != -ENODEV && initcall_debug) { | 721 | if (result && result != -ENODEV && initcall_debug) |
728 | sprintf(msgbuf, "error code %d", result); | 722 | sprintf(msgbuf, "error code %d ", result); |
729 | msg = msgbuf; | 723 | |
730 | } | 724 | if (preempt_count() != count) { |
731 | if (preempt_count() != count) { | 725 | strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); |
732 | msg = "preemption imbalance"; | 726 | preempt_count() = count; |
733 | preempt_count() = count; | 727 | } |
734 | } | 728 | if (irqs_disabled()) { |
735 | if (irqs_disabled()) { | 729 | strlcat(msgbuf, "disabled interrupts ", sizeof(msgbuf)); |
736 | msg = "disabled interrupts"; | 730 | local_irq_enable(); |
737 | local_irq_enable(); | 731 | } |
738 | } | 732 | if (msgbuf[0]) { |
739 | if (msg) { | 733 | print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn); |
740 | print_fn_descriptor_symbol(KERN_WARNING "initcall %s()", | 734 | printk(" returned with %s\n", msgbuf); |
741 | (unsigned long) *call); | ||
742 | printk(" returned with %s\n", msg); | ||
743 | } | ||
744 | } | 735 | } |
736 | } | ||
737 | |||
738 | |||
739 | extern initcall_t __initcall_start[], __initcall_end[]; | ||
740 | |||
741 | static void __init do_initcalls(void) | ||
742 | { | ||
743 | initcall_t *call; | ||
744 | |||
745 | for (call = __initcall_start; call < __initcall_end; call++) | ||
746 | do_one_initcall(*call); | ||
745 | 747 | ||
746 | /* Make sure there is no pending stuff from the initcall sequence */ | 748 | /* Make sure there is no pending stuff from the initcall sequence */ |
747 | flush_scheduled_work(); | 749 | flush_scheduled_work(); |