Alan Stern wrote: > On Tue, 23 May 2006, Franck Bui-Huu wrote: > >> Franck Bui-Huu wrote: >>> /* wait for the completion of the URB */ >>> - wait_for_completion(&urb_done); >>> - clear_bit(US_FLIDX_URB_ACTIVE, &us->flags); >>> + timeout = wait_for_completion_interruptible_timeout( >>> + &urb_done, timeout ? : MAX_SCHEDULE_TIMEOUT); >>> >>> - /* clean up the timeout timer */ >>> - if (timeout > 0) >>> - del_timer_sync(&to_timer); >>> + 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"... > need to store the return value from > wait_for_completion_interruptible_timeout in a long instead of an int, > because MAX_SCHEDULE_TIMEOUT is defined as LONG_MAX. > correct, I'll do that. Franck ------------------------------------------------------- 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 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel