summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-05-15 18:14:01 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-15 18:14:01 -0700
commite0df154f45e40677781e971daec6c430cb34716b (patch)
tree079e0dad9f21a780f50aaa9c5878721a9a7ed0e0 /init
parenta442ac512f36981182e66a427ad05f449ff6593b (diff)
downloadblackbird-op-linux-e0df154f45e40677781e971daec6c430cb34716b.tar.gz
blackbird-op-linux-e0df154f45e40677781e971daec6c430cb34716b.zip
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)
}
__setup("initcall_debug", initcall_debug_setup);
-extern initcall_t __initcall_start[], __initcall_end[];
-
-static void __init do_initcalls(void)
+static void __init do_one_initcall(initcall_t fn)
{
- initcall_t *call;
int count = preempt_count();
+ ktime_t t0, t1, delta;
+ char msgbuf[40];
+ int result;
- for (call = __initcall_start; call < __initcall_end; call++) {
- ktime_t t0, t1, delta;
- char msgbuf[40];
- int result;
-
- if (initcall_debug) {
- print_fn_descriptor_symbol("calling %s\n", *call);
- t0 = ktime_get();
- }
+ if (initcall_debug) {
+ print_fn_descriptor_symbol("calling %s\n", fn);
+ t0 = ktime_get();
+ }
- result = (*call)();
+ result = fn();
- if (initcall_debug) {
- t1 = ktime_get();
- delta = ktime_sub(t1, t0);
+ if (initcall_debug) {
+ t1 = ktime_get();
+ delta = ktime_sub(t1, t0);
- print_fn_descriptor_symbol("initcall %s", *call);
- printk(" returned %d after %Ld msecs\n", result,
- (unsigned long long) delta.tv64 >> 20);
- }
+ print_fn_descriptor_symbol("initcall %s", fn);
+ printk(" returned %d after %Ld msecs\n", result,
+ (unsigned long long) delta.tv64 >> 20);
+ }
- msgbuf[0] = 0;
+ msgbuf[0] = 0;
- if (result && result != -ENODEV && initcall_debug)
- sprintf(msgbuf, "error code %d ", result);
+ if (result && result != -ENODEV && initcall_debug)
+ sprintf(msgbuf, "error code %d ", result);
- if (preempt_count() != count) {
- strncat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
- preempt_count() = count;
- }
- if (irqs_disabled()) {
- strncat(msgbuf, "disabled interrupts ", sizeof(msgbuf));
- local_irq_enable();
- }
- if (msgbuf[0]) {
- print_fn_descriptor_symbol(KERN_WARNING "initcall %s", *call);
- printk(" returned with %s\n", msgbuf);
- }
+ if (preempt_count() != count) {
+ strncat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
+ preempt_count() = count;
}
+ if (irqs_disabled()) {
+ strncat(msgbuf, "disabled interrupts ", sizeof(msgbuf));
+ local_irq_enable();
+ }
+ if (msgbuf[0]) {
+ print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn);
+ printk(" returned with %s\n", msgbuf);
+ }
+}
+
+
+extern initcall_t __initcall_start[], __initcall_end[];
+
+static void __init do_initcalls(void)
+{
+ initcall_t *call;
+
+ for (call = __initcall_start; call < __initcall_end; call++)
+ do_one_initcall(*call);
/* Make sure there is no pending stuff from the initcall sequence */
flush_scheduled_work();
OpenPOWER on IntegriCloud