Perhaps the real question is: Do we need to guarantee that no URBs will
remain outstanding after disconnect() returns?  This seems to be what you
are getting at.  Unfortunately, I haven't seen written down anywhere
exactly what conditions the driver needs to satisfy.  It would be nice if
this sort of thing could be added to the documentation somewhere.
From <linux/usb.h> 2.5.44, the kerneldoc describing struct usb_driver:

* The probe() and disconnect() methods are called in a context where
* they can sleep, but they should avoid abusing the privilege. Most
* work to connect to a device should be done when the device is opened,
* and undone at the last close. The disconnect code needs to address
* concurrency issues with respect to open() and close() methods, as
* well as forcing all pending I/O requests to complete (by unlinking
* them as necessary, and blocking until the unlinks complete).

Don't forget to test the kernel documentation, as well as the C code! :)

In 2.4 if you kept some urbs active after your driver said it was done
with the interface (by returning from disconnect) that'd sometimes cause
an oops. I think now that's less likely, but drivers which can't ensure
they've shut down their I/O are still likely to make something break.

- Dave




-------------------------------------------------------
This sf.net email is sponsored by: Influence the future of Java(TM) technology. Join the Java Community Process(SM) (JCP(SM)) program now. http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0002en

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Reply via email to