__init is a qualifier to a function or initialized data and a hint to the linker to place all these code and data in a seperate section in the object file, so that once these functions are executed, memory space occupied by these code and data will be freed.
It is the onus on the Kernel programmer to decide which functions/data to be marked as __init. For Eg. the init functions of a driver module, in most cases will be executed only once and no other functions will invoke this init function. Thus, init function will be the right candidate to be marked as __init. http://lxr.linux.no/#linux+v2.6.37/include/linux/init.h Regards, Prabhu On Mon, Feb 7, 2011 at 12:11 PM, Joy Sun <[email protected]> wrote: > Hi, > > I am totally newbie for kernel device driver, and starting to learn. > > When I see a driver code, I found __init. For example, static int __init > xxxx(struct platform_device *pdev) > > I understand "static" and "int", but what is __init? > > -J. > > _______________________________________________ > Kernelnewbies mailing list > [email protected] > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > >
_______________________________________________ Kernelnewbies mailing list [email protected] http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
