Commit b0eef108 authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

[PATCH] USB: waitqueue related problem in kaweth

this was buggy for the same reason that the old msleep was buggy.

  - safe waiting in case we are left on other wait queues
parent 662be4ac
...@@ -1240,20 +1240,20 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int* actual_length) ...@@ -1240,20 +1240,20 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int* actual_length)
init_waitqueue_head(&awd.wqh); init_waitqueue_head(&awd.wqh);
awd.done = 0; awd.done = 0;
set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&awd.wqh, &wait); add_wait_queue(&awd.wqh, &wait);
urb->context = &awd; urb->context = &awd;
status = usb_submit_urb(urb, GFP_ATOMIC); status = usb_submit_urb(urb, GFP_NOIO);
if (status) { if (status) {
// something went wrong // something went wrong
usb_free_urb(urb); usb_free_urb(urb);
set_current_state(TASK_RUNNING);
remove_wait_queue(&awd.wqh, &wait); remove_wait_queue(&awd.wqh, &wait);
return status; return status;
} }
while (timeout && !awd.done) while (timeout && !awd.done) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout); timeout = schedule_timeout(timeout);
}
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
remove_wait_queue(&awd.wqh, &wait); remove_wait_queue(&awd.wqh, &wait);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment