Oliver Neukum wrote:
	 However, the USB subsystem should be doing
try_module_get before any call into a driver.  But there is one case in
which it doesn't: calling urb completion handlers.  Isn't this wrong?

No. The driver's disconnect method is responsible for unlinking all URBs and
_wait_ for all completion handlers to finish. To do so a synchronous unlink
is the method of choice.
Minor clarification:  it's actually sufficient to wait for the completion
handlers to signal they're returning, at least on 2.5, since the module
unloading logic guarantees that the CPU running that handler will have
scheduled some new task before module unload completes.  (And scheduling
a new task means that irq handlers and tasklets finished running....)
Courtesy of synchronize_kernel().

And I'll disagree that a synchronous unlink is "the method of choice"! ;)

Certainly if there's more than one URB to unlink it's easier to unlink
them all at once and THEN wait, rather than repeat unlink/wait N times.
(That could be argued as just a style issue, though I suspect that
working the async approach through gives real technical advantages.)


Thus a call to a completion handler is always harmless.
... unless the driver's disconnect() is broken badly enough, and yes
we have seen such situations many times.  The best we can do there
is point the finger at the driver -- sometimes.

- Dave




-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to