On Thu, 16 Jan 2003, Oliver Neukum wrote: > > > But I have a problem with usb_unlink_urb() and resubmitting, as you > > suggests. > > > > First of all, usb_unlink_urb() comes in two flavours, asynchronous and > > synchronous. If I use asychronous unlink, it may well be the aim of the > > device driver writer to do a resubmit in the completion function as a > > result of the unlink! (perhaps to implement an external timeout/retry for > > an urb). > > > > And the same completion handler should not be able to do a resubmit if the > > unlink is synchronous? > > There's no such use as far as I am aware. We will add an API call to "delock" > an URB, if need be and if people feel they might need it, we can do it now.
Actually, the design prevents resubmission regardless of whether the unlink was synchronous or asynchronous -- unless the urb is "delocked". > > To avoid races, the unlink function and the completion handler need to have > > exclusive access to the urb. (Spinlock?). We rely more an a separation of interests here. When usb_unlink_urb() is called for an urb whose completion handler is running, the only fields it touches are ones that the completion handler is not allowed to touch (i.e., only internally used fields). And there is a spinlock involved. > > > Correct. There are two cases of usb_unlink_urb() being called on an > > > unlinked URB. > > > Calling it on an URB that is not yet linked is a driver bug. > > > Calling it on an URB that is no longer linked is not an error, > > > it's unavoidable. > > > > How do you differ between the two cases? They may be the same. > > How so? Although they aren't literally the same, they are indistinguishable to usb_unlink_urb(). Either way, it just returns a code indicating that it was asked to unlink an urb that is not currently linked. Alan Stern ------------------------------------------------------- This SF.NET email is sponsored by: Thawte.com Understand how to protect your customers personal information by implementing SSL on your Apache Web Server. Click here to get our FREE Thawte Apache Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel