]> git.hungrycats.org Git - linux/commitdiff
[PATCH] USB: waitqueue related problem in kaweth
authorOliver Neukum <oliver@neukum.org>
Mon, 24 May 2004 10:03:19 +0000 (03:03 -0700)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 24 May 2004 10:03:19 +0000 (03:03 -0700)
this was buggy for the same reason that the old msleep was buggy.

  - safe waiting in case we are left on other wait queues

drivers/usb/net/kaweth.c

index aea805b28351ef0cd6f03f475bbe487224172205..e13c4d778743b9c6a5b3ab8b043fbdf705a34e7f 100644 (file)
@@ -1240,20 +1240,20 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int* actual_length)
         init_waitqueue_head(&awd.wqh);
         awd.done = 0;
 
-        set_current_state(TASK_INTERRUPTIBLE);
         add_wait_queue(&awd.wqh, &wait);
         urb->context = &awd;
-        status = usb_submit_urb(urb, GFP_ATOMIC);
+        status = usb_submit_urb(urb, GFP_NOIO);
         if (status) {
                 // something went wrong
                 usb_free_urb(urb);
-                set_current_state(TASK_RUNNING);
                 remove_wait_queue(&awd.wqh, &wait);
                 return status;
         }
 
-       while (timeout && !awd.done)
+       while (timeout && !awd.done) {
+               set_current_state(TASK_UNINTERRUPTIBLE);
                timeout = schedule_timeout(timeout);
+       }
 
         set_current_state(TASK_RUNNING);
         remove_wait_queue(&awd.wqh, &wait);