Messages in this thread | | | Date | Wed, 1 Oct 2008 09:21:23 -0700 | From | "Yinghai Lu" <> | Subject | Re: [patch 2/2] PNP: don't check disabled PCI BARs for conflicts in quirk_system_pci_resources() |
| |
On Wed, Oct 1, 2008 at 8:14 AM, Linus Torvalds <torvalds@linux-foundation.org> wrote: > > and instead do > > initcall(pci_init, "pci"); > .. > initcall(pnp_init, "pnp"); > > and then just list the levels for the linker scripts in one place. So that > we wouldn't really have to worry about link ordering: if the link ordering > is wrong, we just add a new initcall level and insert it in the right > place, and then we can look at the ordering and see it explicitly in one > place instead of looking at the makefiles and checking the order we add > object files to the list in!
don't need to think linking order. could reorder them in the run time.
struct init_call_st { int level; char *name; initcall_t call; };
#define INIT_CALL(nameX, levelX, callX) \ static struct init_call_st __init_call_##nameX __initdata = \ { .name = nameX,\ .level = levelX,\ .call = callX,\ }; \ static struct init_call_st *__init_call_ptr_##nameX __used \ __attribute__((__section__(".init_call.init"))) = \ &__init_call_##nameX
in vmlinux.lds.h #define INIT_CALL_INIT(align) \ . = ALIGN((align)); \ .init_call.init : AT(ADDR(.init_call.init) - LOAD_OFFSET) { \ VMLINUX_SYMBOL(__init_call_start) = .; \ *(.init_call.init) \ VMLINUX_SYMBOL(__init_call_end) = .; \ }
let arch vmlinux.lds.S to have INIT_CALL_INIT(8)
and init/main.c
void __init do_init_calls(void) { struct init_call_st **daa; char *ptr;
/* sort it?, prescan... */ for (daa = __init_call_start ; daa < __init_call_end; daa++) { struct init_call_st *da = *daa;
... }
for (daa = __init_call_start ; daa < __init_call_end; daa++) { struct dyn_array *da = *daa; ... da->call(); }
YH
| |