Re: Device Initialization.

Andi Kleen (ak@muc.de)
19 Aug 1997 19:01:15 +0200


"Pawel S. Veselov" <vps@unicorn.niimm.spb.su> writes:

> > I've looked at kernel sources, and I can't find a place where to
> >put a code to automatically initialize my device at startup... Where's it?
>
> Use:
> __initfunc(int your_init(<init args>))
> {
> ...
> }
>
> Init args are often "void" or "unsigned long kmem_start"
>
> This is described in <linux/init.h>

Be careful, __initfunc only means that the code is freed after the
kernel initialization. You still have to add a call to the function
somewhere else. One place for this is init/main.c:start_kernel() for
general functions, drivers/net/Space.c for network drivers, drivers/char/mem.c
for character devices, fs/filesystems.c for filesystems etc.

-Andi