[parisc-linux] initcall and setup
Matthew Wilcox
willy@thepuffingroup.com
Fri, 14 Jan 2000 17:48:31 -0500
One of the things which has changed during 2.3 development is
initialisation. We used to have files full of:
#ifdef CONFIG_FOO
init_foo();
#endif
#ifdef CONFIG_BAR
init_bar();
#endif
#ifdef CONFIG_QUUX
init_quux();
#endif
which was pretty ugly stuff.
Instead, we have declarations like:
__setup("video=", video_setup);
__setup("wd33c93", wd33c93_setup);
__setup("es1370=", es1370_setup);
in each driver and then a loop in init/main.c which goes through and
calls all the __setup functions. Much prettier, more modular, less
dependent on CONFIG_, etc.
Unfortunately, we can't take advantage of this, because we don't yet have
ELF tools. This is implemented through an ELF section called __initcall
which contains the address of the function to call. We could try to hack
something together with SOM, but I'd really rather not put the work in
that will just be dumped later.
This explains why we get some of the warnings on compilation;' eg:
init/main.c:170: warning: `__setup_profile_setup' defined but not used
and why if you diff our kernel against Linus', you will find that we have
reinserted some of the explicit calls to the setup routines that have
been eliminated from the mainline tree. It also explains why sometimes
a driver may not be called even though you compiled it in.