[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: __init and __exit vs module_init()



My understanding is that __init causes the the kernel to call that function
during the boot process _and_ to throw away that function once it has been
called. (So, don't call it again after that. I found that one out the hard
way.)

John

----- Original Message -----
From: "Dan Erickson" <coldoneknight@rogers.com>
To: <kernelnewbies@nl.linux.org>
Sent: Thursday, April 11, 2002 8:57 AM
Subject: __init and __exit vs module_init()


>
> Howdy,
>
> What I am wondering is, is __init equal to module_init()?
> Basicly... I was confussed as to what happens if you want to
> compile a driver directly into the kernel. Then I discovered __init.
> There needs to be some way the kernel knows what the entry point
> of the driver is, and if you have module_init() everything is all well and
> good, the kernel is happy as it knows what the entry point is, but what if
> you dont compile as a module? Then all of a suddenly the kernel doesnt
> know what the entry point is because all you have given it is the entry
> point "IF" it was compiled as a module. Is the purpose of __init to tell
> the kernel the entry point in the event that the driver is compiled
> directly into the kernel?
> The best answer I could get would be from "Linux Device Drivers"
> by Oreilly. Though I found there explanation cryptic.
>
> Thanks for the help
>
> -Dan Erickson-
> -ColdOneKnight@rogers.com-
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/