ChangeSet 1.1743.3.4, 2004/05/24 17:03:19-07:00, oliver@neukum.org

[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


 drivers/usb/net/kaweth.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)


diff -Nru a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c
--- a/drivers/usb/net/kaweth.c	Fri May 28 14:41:36 2004
+++ b/drivers/usb/net/kaweth.c	Fri May 28 14:41:36 2004
@@ -1240,20 +1240,20 @@
         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);
