ChangeSet 1.2020.1.22, 2005/03/07 22:34:19-08:00, [EMAIL PROTECTED]

[PATCH] usb/ati_remote: use wait_event_timeout()

Description: Use wait_event_timeout() instead of custom wait-queue code. The
current code uses TASK_INTERRUPTIBLE but doesn't seem to care about signals
so TASK_UNINTERRUPTIBLE should be ok.

Signed-off-by: Nishanth Aravamudan <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


 drivers/usb/input/ati_remote.c |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)


diff -Nru a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
--- a/drivers/usb/input/ati_remote.c    2005-03-08 16:54:28 -08:00
+++ b/drivers/usb/input/ati_remote.c    2005-03-08 16:54:28 -08:00
@@ -94,6 +94,7 @@
 #include <linux/moduleparam.h>
 #include <linux/input.h>
 #include <linux/usb.h>
+#include <linux/wait.h>
 
 /*
  * Module and Version Information, Module Parameters
@@ -396,8 +397,6 @@
  */
 static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, 
unsigned char *data)
 {
-       DECLARE_WAITQUEUE(wait, current);
-       int timeout = HZ;       /* 1 second */
        int retval = 0;
        
        /* Set up out_urb */
@@ -415,18 +414,10 @@
                return retval;
        }
 
-       set_current_state(TASK_INTERRUPTIBLE);
-       add_wait_queue(&ati_remote->wait, &wait);
-
-       while (timeout && (ati_remote->out_urb->status == -EINPROGRESS) 
-              && !(ati_remote->send_flags & SEND_FLAG_COMPLETE)) {
-               set_current_state(TASK_INTERRUPTIBLE);
-               timeout = schedule_timeout(timeout);
-               rmb();
-       }
-
-       set_current_state(TASK_RUNNING);
-       remove_wait_queue(&ati_remote->wait, &wait);
+       wait_event_timeout(ati_remote->wait,
+               ((ati_remote->out_urb->status != -EINPROGRESS) ||
+                       (ati_remote->send_flags & SEND_FLAG_COMPLETE)),
+               HZ);
        usb_kill_urb(ati_remote->out_urb);
        
        return retval;



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to