* [KJ] [PATCH 33/39] usb/ati_remote: use wait_event_timeout()
@ 2005-01-21 21:31 Nishanth Aravamudan
0 siblings, 0 replies; only message in thread
From: Nishanth Aravamudan @ 2005-01-21 21:31 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1607 bytes --]
Hi,
Please consider applying.
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 <nacc@us.ibm.com>
--- 2.6.11-rc1-kj-v/drivers/usb/input/ati_remote.c 2005-01-15 16:55:42.000000000 -0800
+++ 2.6.11-rc1-kj/drivers/usb/input/ati_remote.c 2005-01-17 19:36:44.000000000 -0800
@@ -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 void ati_remote_irq_out(struct ur
*/
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 @@ static int ati_remote_sendpacket(struct
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;
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-01-21 21:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-21 21:31 [KJ] [PATCH 33/39] usb/ati_remote: use wait_event_timeout() Nishanth Aravamudan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.