I think you're right here; there are (at least) 3 things that need to be done when disconnecting a driver from a device (interface):

1. The driver must stop using the interface.
2. All pending URBs must be aborted.
3. The device (or interface) should be placed into a stable/reset state.

...
Currently, #1 is done by usbdevfs, not (AFAIK) #2. And #3 is really up to whatever new driver takes over.
#2 is currently the driver's responsibility, as part of #1;
it's not really separarable, since if there were a pending URB
that's not aborted, #1 wouldn't have been achieved.

a driver is supposed to abort URBs after a device is disconnected?
It's supposed to do that in disconnect(), yes, for any
urbs that haven't yet completed.  In what way would it
be possible to achieve #1 without #2 ??

You (and Oliver) seem to be assuming that disconnect() is
about hardware.  It's not.  It's about driver unbinding.
The unbinding does happen when hardware goes away, but
it also happens at other times (driver rmmod, etc).


I thought those URBs would be completed with error (ENODEV or ECONNRESET).
That's what happens when the driver unlinks them (synchronously or
asynchronously, respectively).

I may yet update the 2.5 tree to have more provably correct
handling for physical disconnects, which might add a "forcible
unlink" step that's so far been lacking.  That'd just be to
make sure that drivers with buggy disconnect() processing are
no longer able to cause oopses, hangs, or any of the other
non-localized failure modes such localized bugs now cause.


In fact patches have recently been integrated (2.4, 2,5)
to address a usbfs bug where it wasn't doing that.

I thought that was to fix (voluntarily) releasing an interface with pending URBs, which is different than an interface being disconnected with pending URBs.
Ah yes that's right ... it was almost the same thing though.
However, I did fix disconnect() not that long ago; I seem
to recall that 2.4.19 had that bug, certainly 2.4.18 did.

The reason _why_ a driver releases an interface doesn't
change the semantics of releasing it. Releasing involves
your point #1 (which implies #2).

- Dave






-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET comprehensive development tool, built to increase your productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to