Re: What is __init?

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

 



__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 <joy2sun127@xxxxxxxxx> 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
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux