aboutsummaryrefslogtreecommitdiffstats
path: root/init/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'init/main.c')
-rw-r--r--init/main.c80
1 files changed, 41 insertions, 39 deletions
diff --git a/init/main.c b/init/main.c
index f406fefa626c..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
696extern initcall_t __initcall_start[], __initcall_end[]; 696static void __init do_one_initcall(initcall_t fn)
697
698static 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 msgbuf[40]; 705 t0 = ktime_get();
706 int result; 706 }
707
708 if (initcall_debug) {
709 print_fn_descriptor_symbol("calling %s()\n",
710 (unsigned long) *call);
711 t0 = ktime_get();
712 }
713 707
714 result = (*call)(); 708 result = fn();
715 709
716 if (initcall_debug) { 710 if (initcall_debug) {
717 t1 = ktime_get(); 711 t1 = ktime_get();
718 delta = ktime_sub(t1, t0); 712 delta = ktime_sub(t1, t0);
719 713
720 print_fn_descriptor_symbol("initcall %s()", 714 print_fn_descriptor_symbol("initcall %s", fn);
721 (unsigned long) *call); 715 printk(" returned %d after %Ld msecs\n", result,
722 printk(" returned %d after %Ld msecs\n", result, 716 (unsigned long long) delta.tv64 >> 20);
723 (unsigned long long) delta.tv64 >> 20); 717 }
724 }
725 718
726 msgbuf[0] = 0; 719 msgbuf[0] = 0;
727 720
728 if (result && result != -ENODEV && initcall_debug) 721 if (result && result != -ENODEV && initcall_debug)
729 sprintf(msgbuf, "error code %d ", result); 722 sprintf(msgbuf, "error code %d ", result);
730 723
731 if (preempt_count() != count) { 724 if (preempt_count() != count) {
732 strncat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); 725 strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
733 preempt_count() = count; 726 preempt_count() = count;
734 }
735 if (irqs_disabled()) {
736 strncat(msgbuf, "disabled interrupts ", sizeof(msgbuf));
737 local_irq_enable();
738 }
739 if (msgbuf[0]) {
740 print_fn_descriptor_symbol(KERN_WARNING "initcall %s()",
741 (unsigned long) *call);
742 printk(" returned with %s\n", msgbuf);
743 }
744 } 727 }
728 if (irqs_disabled()) {
729 strlcat(msgbuf, "disabled interrupts ", sizeof(msgbuf));
730 local_irq_enable();
731 }
732 if (msgbuf[0]) {
733 print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn);
734 printk(" returned with %s\n", msgbuf);
735 }
736}
737
738
739extern initcall_t __initcall_start[], __initcall_end[];
740
741static 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();