On Tue, 23 May 2006, Franck Bui-Huu wrote:
> >>> + if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->flags) && timeout <=
> >>> 0) {
> >> Thinking more about it, I'm wondering it the second condition (timeout <=
> >> 0)
> >> is really needed. Do you think so ?
> >
> > The test is needed because you shouldn't print a debugging message or
> > call usb_unlink_urb when the URB completes normally. However you will
>
> 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.
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.
Alan Stern
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel