Re: [RFC] Unifying kernel initialization

Jakub Jelinek (jj@sunsite.ms.mff.cuni.cz)
Wed, 5 May 1999 08:24:23 +0200


On Wed, May 05, 1999 at 01:08:03AM +1000, Martijn van Oosterhout wrote:
> One of the things I've always found a little
> strange about drivers in the Linux kernel, was
> that the driver code was different depending
> on whether it was built into the kernel or not.
>
> If it was built into the kernel, you'd have to
> add it to the mess in init/main.c or similar
> and add a call for it somewhere. If it's a
> module, some code needs to be added in the
> module surrounded by #ifdef's
>
> This all seems terribly clumsy. I was thinking
> that a better way to do it would be to have a
> macro REGISTER_INIT_FUNC(function,priority),
> which would add the nessesary info to the
> object file. Then, the kernel would need only
> to loop over this list and all the kernel would
> be initialized in order.

This is still not sufficient. In 2.3, you want to be able to
initialize/deinitialize a single card driven by a driver, otherwise stuff
like hot plug is not possible. So just marking an init function has not much
value, really.
Every driver should announce in some special sections what kind of devices
it drives (bus types, and bus ids: PCI ids, SBUS strings, ISA io-ports,
etc.), some detection routine and init/cleanup. Now you could do something
like initialize PCI bus N and it would do it. The buses themselves should
have control structures as well.

Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
UltraLinux | http://ultra.linux.cz/ | http://ultra.penguin.cz/
Linux version 2.2.7 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/