Use wait_event_timeout() instead of custom wait-queue code. Remove now unused variables. I changed the code to only add to the wait-queue if necessary, but I'm not sure if this is correct. Signed-off-by: Nishanth Aravamudan Signed-off-by: Domen Puncer --- kj-domen/drivers/usb/net/kaweth.c | 13 ++----------- 1 files changed, 2 insertions(+), 11 deletions(-) diff -puN drivers/usb/net/kaweth.c~wait_event_timeout-drivers_usb_net_kaweth drivers/usb/net/kaweth.c --- kj/drivers/usb/net/kaweth.c~wait_event_timeout-drivers_usb_net_kaweth 2005-03-02 10:43:50.000000000 +0100 +++ kj-domen/drivers/usb/net/kaweth.c 2005-03-02 10:43:50.000000000 +0100 @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -1180,31 +1181,21 @@ static void usb_api_blocking_completion( // Starts urb and waits for completion or timeout static int usb_start_wait_urb(struct urb *urb, int timeout, int* actual_length) { - DECLARE_WAITQUEUE(wait, current); struct usb_api_data awd; int status; init_waitqueue_head(&awd.wqh); awd.done = 0; - add_wait_queue(&awd.wqh, &wait); urb->context = &awd; status = usb_submit_urb(urb, GFP_NOIO); if (status) { // something went wrong usb_free_urb(urb); - remove_wait_queue(&awd.wqh, &wait); return status; } - while (timeout && !awd.done) { - set_current_state(TASK_UNINTERRUPTIBLE); - timeout = schedule_timeout(timeout); - } - - remove_wait_queue(&awd.wqh, &wait); - - if (!timeout) { + if (!wait_event_timeout(awd.wqh, awd.done, timeout)) { // timeout kaweth_warn("usb_control/bulk_msg: timeout"); usb_kill_urb(urb); // remove urb safely _