Re: __devinit, __devexit, __init and __exit

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

 



On Sun, Jul 06, 2003 at 11:00:05PM +0200, Jules Colding wrote:

> Could someone please explain to me the rationale of using a specific one
> of the above macros? I am confused about when it is correct to use e.g.

The "dev" is short for "device"


Documentation/pci.txt

Please mark the initialization and cleanup functions where appropriate
(the corresponding macros are defined in <linux/init.h>):

        __init          Initialization code. Thrown away after the
driver
                        initializes.
        __exit          Exit code. Ignored for non-modular drivers.
        __devinit       Device initialization code. Identical to __init
if
                        the kernel is not compiled with CONFIG_HOTPLUG,
normal
                        function otherwise.
        __devexit       The same for __exit.

Tips:
        The module_init()/module_exit() functions (and all
initialization
        functions called only from these) should be marked __init/exit.
        The struct pci_driver shouldn't be marked with any of these
tags.
        The ID table array should be marked __devinitdata.
        The probe() and remove() functions (and all initialization
        functions called only from these) should be marked
__devinit/exit.
        If you are sure the driver is not a hotplug driver then use only
        __init/exit __initdata/exitdata.

        Pointers to functions marked as __devexit must be created using
        __devexit_p(function_name).  That will generate the function
        name or NULL if the __devexit function will be discarded.


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



[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