Am Sonntag, 12. Januar 2003 09:11 schrieb Greg KH: > On Sat, Jan 11, 2003 at 11:39:55AM +0100, Oliver Neukum wrote: > > Currently there's no way to tell an urb executing its completion handler > > from a finished urb. So we wouldn't have to poll, but could wake the task > > doing the unlink from usb_hcd_giveback_urb(). In fact we'd have to. > > Then why don't we finally fix this problem? Just give the urb a > different status while in the completion handler, and then fix up a few > drivers. It shouldn't be that hard :)
Sir, yes, sir! To read is to obey ;-) OK, if we are to do this let's do it right and divorce state from error reporting. As far as I can tell an URB should have four states, with preliminary names: 1 - URB_FREE 2 - URB_SUBMITTED 3 - URB_COMPLETING 4 - URB_CANCELED with the following transitions allowed: 1->2, 2->3, 3->1, 3->2, 3->4, 4->1 usb_alloc_urb() will make you an URB in state URB_FREE transition 1->2: usb_submit_urb() after sanity checking transition 2->3: usb_hcd_giveback_urb() before complete transition 3->1: usb_hcd_giveback_urb() after complete transition 3->2 (resubmit in completion handler): same as 1->2 transition 3->4: usb_unlink_urb(), if a synchronous unlink is called for an URB in state URB_COMPLETING transition 4->1: usb_hcd_giveback_urb() after complete The interesting change is the state URB_CANCELED which causes usb_submit_urb() to fail and usb_hcd_giveback_urb() to wake up the thread having done a synchronous unlink. Should asynchronous unlink remain unchanged? Or should it change the urb into state URB_CANCELED and just not wait? Do we have to guarantee that usb_submit_urb() returns before the completion handler is called? Regards Oliver ------------------------------------------------------- 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