2006/5/23, Alan Stern <[EMAIL PROTECTED]>:
On Tue, 23 May 2006, Franck Bui-Huu wrote:
> ok but my point is if the US_FLIDX_URB_ACTIVE bit is still set after waiting,
> doesn't that mean that the URB doesn't complete normally ? If so we should
> call usb_unlink_urb whatever the value of "timeout"...

No, if the bit is still set it means only that usb_unlink_urb hasn't been
called.  In the original code it was possible that the URB had completed
normally (that's why the routine called clear_bit).  In your revised code
it's possible that the URB completed normally or that it is still active.
You want to call usb_unlink_urb only in the case where the URB is still
active, that is, where the timeout has expired or been interrupted by a
signal.


ok so the code can be rewritten as following:

      clear_bit(US_FLIDX_URB_ACTIVE, &us->flags);
      if (timeout <= 0) {
              US_DEBUGP("%s -- cancelling URB\n", !timeout ?
"Timeout" : "Signal");
              usb_unlink_urb(us->current_urb);
      }

Come to think of it, the code always needs to wait until the URB has
completed.  So after you call usb_unlink_urb, you need another
wait_for_completion -- non-interruptible and with no timeout.

It seems to be needed for _all_ drivers. A generic service provided by the core
which unlinks an urb _and_ waits for its completion...maybe we should start a
new thread for that...

thanks
--
              Franck


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid7521&bid$8729&dat1642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to