On Wed, 6 Aug 2003, Soewono Effendi wrote:

> As far as I understand, __init / __devinit is only relevant for device
> driver (codes) that are statically linked. In the case of USB Device
> Driver (not usbcore / usbhost ), one should actually not use
> __init/__devinit, since USB probe can happen at any time, unless the
> device is "static", i.e., not unplugable (I don't know if this word does
> exist :) ).

>From 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.


The upshot is that for USB, which is hotpluggable, __devinit and __devexit 
are useless.  __init and __exit should be used for module initialization 
and removal routines, not for probing and disconnecting.

Alan Stern



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to