aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-05-15 21:14:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-15 21:14:01 -0400
commite0df154f45e40677781e971daec6c430cb34716b (patch)
tree079e0dad9f21a780f50aaa9c5878721a9a7ed0e0 /init
parenta442ac512f36981182e66a427ad05f449ff6593b (diff)
Split up 'do_initcalls()' into two simpler functions
One function to just loop over the entries, one function to actually do the call and the associated debugging code. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init')
-rw-r--r--init/main.c77
1 files changed, 41 insertions, 36 deletions
diff --git a/init/main.c b/init/main.c
index c62215146a80..b8bcf6da8a77 100644
--- a/init/main.c
+++ b/init/main.c
@@ -693,52 +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[40];
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", *call);
710 t0 = ktime_get();
711 }
712 707
713 result = (*call)(); 708 result = fn();
714 709
715 if (initcall_debug) { 710 if (initcall_debug) {
716 t1 = ktime_get(); 711 t1 = ktime_get();
717 delta = ktime_sub(t1, t0); 712 delta = ktime_sub(t1, t0);
718 713
719 print_fn_descriptor_symbol("initcall %s", *call); 714 print_fn_descriptor_symbol("initcall %s", fn);
720 printk(" returned %d after %Ld msecs\n", result, 715 printk(" returned %d after %Ld msecs\n", result,
721 (unsigned long long) delta.tv64 >> 20); 716 (unsigned long long) delta.tv64 >> 20);
722 } 717 }
723 718
724 msgbuf[0] = 0; 719 msgbuf[0] = 0;
725 720
726 if (result && result != -ENODEV && initcall_debug) 721 if (result && result != -ENODEV && initcall_debug)
727 sprintf(msgbuf, "error code %d ", result); 722 sprintf(msgbuf, "error code %d ", result);
728 723
729 if (preempt_count() != count) { 724 if (preempt_count() != count) {
730 strncat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); 725 strncat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
731 preempt_count() = count; 726 preempt_count() = count;
732 }
733 if (irqs_disabled()) {
734 strncat(msgbuf, "disabled interrupts ", sizeof(msgbuf));
735 local_irq_enable();
736 }
737 if (msgbuf[0]) {
738 print_fn_descriptor_symbol(KERN_WARNING "initcall %s", *call);
739 printk(" returned with %s\n", msgbuf);
740 }
741 } 727 }
728 if (irqs_disabled()) {
729 strncat(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);
742 747
743 /* Make sure there is no pending stuff from the initcall sequence */ 748 /* Make sure there is no pending stuff from the initcall sequence */
744 flush_scheduled_work(); 749 flush_scheduled_work();