* [KJ] [PATCH 38/39] usb/usblp: use wait_event_interruptible_timeout()
@ 2005-01-21 21:40 Nishanth Aravamudan
0 siblings, 0 replies; only message in thread
From: Nishanth Aravamudan @ 2005-01-21 21:40 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1685 bytes --]
Hi,
Please consider applying.
Description: Use wait_event_timeout() instead of custom wait-queue code. Remove
now unused variables.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
--- 2.6.11-rc1-kj-v/drivers/usb/class/usblp.c 2005-01-15 16:55:42.000000000 -0800
+++ 2.6.11-rc1-kj/drivers/usb/class/usblp.c 2005-01-21 13:39:06.000000000 -0800
@@ -54,6 +54,7 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/lp.h>
+#include <linux/wait.h>
#undef DEBUG
#include <linux/usb.h>
@@ -622,10 +623,10 @@ done:
static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
{
- DECLARE_WAITQUEUE(wait, current);
struct usblp *usblp = file->private_data;
- int timeout, err = 0, transfer_length = 0;
+ int err = 0, transfer_length = 0;
size_t writecount = 0;
+ long ret;
while (writecount < count) {
if (!usblp->wcomplete) {
@@ -635,21 +636,10 @@ static ssize_t usblp_write(struct file *
return writecount ? writecount : -EAGAIN;
}
- timeout = USBLP_WRITE_TIMEOUT;
- add_wait_queue(&usblp->wait, &wait);
- while (timeout) {
- if (signal_pending(current)) {
- remove_wait_queue(&usblp->wait, &wait);
- return writecount ? writecount : -EINTR;
- }
- set_current_state(TASK_INTERRUPTIBLE);
- if (usblp->wcomplete) {
- set_current_state(TASK_RUNNING);
- break;
- }
- timeout = schedule_timeout(timeout);
- }
- remove_wait_queue(&usblp->wait, &wait);
+ ret = wait_event_interruptible_timeout(usblp->wait,
+ usblp->complete, USBLP_WRITE_TIMEOUT);
+ if (ret == -ERESTARTSYS)
+ return writecount ? writecount : -EINTR;
}
down (&usblp->sem);
[-- 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:40 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:40 [KJ] [PATCH 38/39] usb/usblp: use wait_event_interruptible_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.