--- reichtiger <woailinux@163.com> wrote: > I think the __init is telling kernel that this function is executed > once and > never come back . but module_init is to initialize the module when > it is > being insmod. > Direct from Rubini & Corbet online at http://www.xml.com/ldd/chapter/book/ch02.html#t4, regarding the 2.4 kernels: "The attribute __init, <snip>, will cause the initialization function to be discarded, and its memory reclaimed, after initialization is complete. It only works, however, for built-in drivers; it has no effect on modules. __exit, instead, causes the omission of the marked function when the driver is not built as a module; again, in modules, it has no effect. The use of __init (and __initdata for data items) can reduce the amount of memory used by the kernel. There is no harm in marking module initialization functions with __init, even though currently there is no benefit either. Management of initialization sections has not been implemented yet for modules, but it's a possible enhancement for the future." If you still believe the above is cryptic, I'll try to explain in even simpler terms... Harmony, --Christine > ----- Original Message ----- > From: "Dan Erickson" <coldoneknight@rogers.com> > To: <kernelnewbies@nl.linux.org> > Sent: Thursday, April 11, 2002 11:57 PM > 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. > > __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/