aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2006-03-25 06:07:15 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 11:22:53 -0500
commitc1cda48af8b330a23206eceef3bd030b53c979cd (patch)
treee39240fd743e22804d29ab0f38d5a0d5e64457b7
parentcd02b966bfcad12d1b2e265dc8dbc331d4c184c4 (diff)
[PATCH] initcall failure reporting
We presently ignore the return values from initcalls. But that can carry useful debugging information. So print it out if it's non-zero. It turns out the -ENODEV happens quite a lot, due to built-in drivers which have no hardware to drive. So suppress that unless initcall_debug was specified. Also make the warning message more friendly by printing the name of the initcall function. Also drop the KERN_DEBUG from the initcall_debug message. If we specified inticall_debug then we obviously want to see the messages. Acked-by: Paul Jackson <pj@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--init/main.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/init/main.c b/init/main.c
index 2714e0e7cfec..a596cb8ac982 100644
--- a/init/main.c
+++ b/init/main.c
@@ -571,17 +571,23 @@ static void __init do_initcalls(void)
571 int count = preempt_count(); 571 int count = preempt_count();
572 572
573 for (call = __initcall_start; call < __initcall_end; call++) { 573 for (call = __initcall_start; call < __initcall_end; call++) {
574 char *msg; 574 char *msg = NULL;
575 char msgbuf[40];
576 int result;
575 577
576 if (initcall_debug) { 578 if (initcall_debug) {
577 printk(KERN_DEBUG "Calling initcall 0x%p", *call); 579 printk("Calling initcall 0x%p", *call);
578 print_fn_descriptor_symbol(": %s()", (unsigned long) *call); 580 print_fn_descriptor_symbol(": %s()",
581 (unsigned long) *call);
579 printk("\n"); 582 printk("\n");
580 } 583 }
581 584
582 (*call)(); 585 result = (*call)();
583 586
584 msg = NULL; 587 if (result && (result != -ENODEV || initcall_debug)) {
588 sprintf(msgbuf, "error code %d", result);
589 msg = msgbuf;
590 }
585 if (preempt_count() != count) { 591 if (preempt_count() != count) {
586 msg = "preemption imbalance"; 592 msg = "preemption imbalance";
587 preempt_count() = count; 593 preempt_count() = count;
@@ -591,8 +597,10 @@ static void __init do_initcalls(void)
591 local_irq_enable(); 597 local_irq_enable();
592 } 598 }
593 if (msg) { 599 if (msg) {
594 printk(KERN_WARNING "error in initcall at 0x%p: " 600 printk(KERN_WARNING "initcall at 0x%p", *call);
595 "returned with %s\n", *call, msg); 601 print_fn_descriptor_symbol(": %s()",
602 (unsigned long) *call);
603 printk(": returned with %s\n", msg);
596 } 604 }
597 } 605 }
598 606