> > Hi Oliver, you are assuming
> >
> > (1) that usb_register is called within the module, and not on its behalf
> > by eg a different module.
> > (2) that there is a call to usb_deregister in the module's exit routine.
> >
> > These assumptions seem reasonable to me, but should maybe be documented.
>
> Why? I propose the module usage count manipulations here because
> the driver core has mutual exclusion through semaphores for these
> operations.
> Could you elaborate?

(1) is pretty silly.  The problem is if, eg, code somewhere else calls usb_register
for your module after your module is unloaded.  The solution is that the code
calling usb_register should do a try_module_get first.  It is not a problem for the
USB core.

(2) is also silly.  It goes as follows: suppose your module has:

int __init init_module (void)
{
        return usb_register (&my_driver);
}

void __exit cleanup_module (void)
{
}

void *usb_probe (...)
{
        ...
}

void usb_disconnect (...)
{
        ...
}

Then eg the following sequence leads to death:
module initialization, module finalization,
usb_probe called (because eg device plugged in).

Now we all know that any driver writer who does this should
be shot.  But maybe it should be documented.  That's all I'm
saying!

> Also could you look at a possible race between usb_deregister
> and ioctl through usbfs?

Will do.

Duncan.


-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to