On Wed, 31 Jan 2007, Oliver Neukum wrote:

> > Every URB submission (both ctrl and out) is paired with wake_up() in its 
> > completion handler. Before the wake_up() is issued, the HID_CTRL_RUNNING 
> > or HID_OUT_RUNNING flag is cleared. As this is a "1:1 pairing", it's 
> > guaranteed that there will once be a wake_up() called on the waitqueue
> But it is not guaranteed that you will already be on the waitqueue.
> The URB may complete before you call usbhid_wait_io(), then it'll
> dependent on the flags.

True.

> > with both the flags unset (if a timeout doesn't happen sooner, which is 
> > OK). If this "final" wake_up() is called before the usbhid_wait_io() is 
> > called, this is also OK, because then the condition will evaluate to true 
> > and the task won't event sleep on the waitqueue.
> Who tells you that the flags will still be cleared? Somebody else may
> have called usbhid_submit_report() by the time you check the flags.

Yes, but in such case it is again guaranteed that there will be wake_up() 
coming from the URB submission which happened later - either the flags are 
cleared, or wake_up() will eventually happen (you are right that it might 
possibly be wake_up() corresponding to submission of URB submitted later, 
but does that matter?).

Thanks,

-- 
Jiri Kosina

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to