>On Mon, 12 Jan 2004, Axel Waggershauser wrote:
>> Yes, of course, I should get the completion handler called. Since I
>> called the usb_unlink_urb synchronously, I should have expected it to be
>> called before the unlink call returns, right?

I misconception is that usb_unlink_urb() is synchronous if the ASYNC flag
is not given. This is not true, as discussed a while back on this list. For
synchronous unlink, you can use the following routine:

static void unlink_urb_sync(struct urb *urb) {
        int r;
        while ((r=usb_unlink_urb(urb)) == -EBUSY) {
                /* The URB is not anymore linked (status!=-EINPROGRESS) but
                 * usb_unlink_urb() was asynchronous and URB's completion handler 
still will run */
                set_current_state(TASK_UNINTERRUPTIBLE);
                schedule_timeout( (HZ/100)==0 ? 1 : HZ/100);
        }
        /* if (r!=-EBUSY),
         * usb_unlink_urb() called synchronously the completion handler and
         * there's no need to wait or anything else */
}

Ok, your problem likely was not this. Hope this helps at least someone.


-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to