mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
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>
This commit is contained in:
parent
a442ac512f
commit
e0df154f45
1 changed files with 45 additions and 40 deletions
27
init/main.c
27
init/main.c
|
@ -693,30 +693,25 @@ static int __init initcall_debug_setup(char *str)
|
||||||
}
|
}
|
||||||
__setup("initcall_debug", initcall_debug_setup);
|
__setup("initcall_debug", initcall_debug_setup);
|
||||||
|
|
||||||
extern initcall_t __initcall_start[], __initcall_end[];
|
static void __init do_one_initcall(initcall_t fn)
|
||||||
|
|
||||||
static void __init do_initcalls(void)
|
|
||||||
{
|
{
|
||||||
initcall_t *call;
|
|
||||||
int count = preempt_count();
|
int count = preempt_count();
|
||||||
|
|
||||||
for (call = __initcall_start; call < __initcall_end; call++) {
|
|
||||||
ktime_t t0, t1, delta;
|
ktime_t t0, t1, delta;
|
||||||
char msgbuf[40];
|
char msgbuf[40];
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (initcall_debug) {
|
if (initcall_debug) {
|
||||||
print_fn_descriptor_symbol("calling %s\n", *call);
|
print_fn_descriptor_symbol("calling %s\n", fn);
|
||||||
t0 = ktime_get();
|
t0 = ktime_get();
|
||||||
}
|
}
|
||||||
|
|
||||||
result = (*call)();
|
result = fn();
|
||||||
|
|
||||||
if (initcall_debug) {
|
if (initcall_debug) {
|
||||||
t1 = ktime_get();
|
t1 = ktime_get();
|
||||||
delta = ktime_sub(t1, t0);
|
delta = ktime_sub(t1, t0);
|
||||||
|
|
||||||
print_fn_descriptor_symbol("initcall %s", *call);
|
print_fn_descriptor_symbol("initcall %s", fn);
|
||||||
printk(" returned %d after %Ld msecs\n", result,
|
printk(" returned %d after %Ld msecs\n", result,
|
||||||
(unsigned long long) delta.tv64 >> 20);
|
(unsigned long long) delta.tv64 >> 20);
|
||||||
}
|
}
|
||||||
|
@ -735,10 +730,20 @@ static void __init do_initcalls(void)
|
||||||
local_irq_enable();
|
local_irq_enable();
|
||||||
}
|
}
|
||||||
if (msgbuf[0]) {
|
if (msgbuf[0]) {
|
||||||
print_fn_descriptor_symbol(KERN_WARNING "initcall %s", *call);
|
print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn);
|
||||||
printk(" returned with %s\n", msgbuf);
|
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 */
|
/* Make sure there is no pending stuff from the initcall sequence */
|
||||||
flush_scheduled_work();
|
flush_scheduled_work();
|
||||||
|
|
Loading…
Reference in a new issue