Nishanth Aravamudan | 2 Feb 2005 18:56
Picon
Favicon

[KJ] [PATCH 1/20] char/lp: remove interruptible_sleep_on_timeout() usage

Hello,

Please consider applying.

Description: Replace deprecated interruptible_sleep_on_timeout() function calls
with direct wait-queue usage. There may be an existing problem with this driver,
as I am not finding any wake_up_interruptible() callers for the waitq. 
Patch is compile-tested.

Signed-off-by: Nishanth Aravamudan <nacc <at> us.ibm.com>

--- 2.6.11-rc2-kj-v/drivers/char/lp.c	2005-01-24 09:34:06.000000000 -0800
+++ 2.6.11-rc2-kj/drivers/char/lp.c	2005-02-02 09:55:30.000000000 -0800
 <at>  <at>  -127,6 +127,7  <at>  <at> 
 #include <linux/poll.h>
 #include <linux/console.h>
 #include <linux/device.h>
+#include <linux/wait.h>

 #include <linux/parport.h>
 #undef LP_STATS
 <at>  <at>  -218,6 +219,7  <at>  <at>  static int lp_reset(int minor)

 static void lp_error (int minor)
 {
+	DEFINE_WAIT(wait);
 	int polling;

 	if (LP_F(minor) & LP_ABORT)
 <at>  <at>  -225,8 +227,9  <at>  <at>  static void lp_error (int minor)

 	polling = lp_table[minor].dev->port->irq == PARPORT_IRQ_NONE;
 	if (polling) lp_release_parport (&lp_table[minor]);
-	interruptible_sleep_on_timeout (&lp_table[minor].waitq,
-					LP_TIMEOUT_POLLED);
+	prepare_to_wait(&lp_table[minor].waitq, &wait, TASK_INTERRUPTIBLE);
+	schedule_timeout(LP_TIMEOUT_POLLED);
+	finish_wait(&lp_table[minor].waitq, &wait);
 	if (polling) lp_claim_parport_or_block (&lp_table[minor]);
 	else parport_yield_blocking (lp_table[minor].dev);
 }
 <at>  <at>  -410,6 +413,7  <at>  <at>  static ssize_t lp_write(struct file * fi
 static ssize_t lp_read(struct file * file, char __user * buf,
 		       size_t count, loff_t *ppos)
 {
+	DEFINE_WAIT(wait);
 	unsigned int minor=iminor(file->f_dentry->d_inode);
 	struct parport *port = lp_table[minor].dev->port;
 	ssize_t retval = 0;
 <at>  <at>  -458,9 +462,11  <at>  <at>  static ssize_t lp_read(struct file * fil
 				retval = -EIO;
 				goto out;
 			}
-		} else
-			interruptible_sleep_on_timeout (&lp_table[minor].waitq,
-							LP_TIMEOUT_POLLED);
+		} else {
+			prepare_to_wait(&lp_table[minor].waitq, &wait, TASK_INTERRUPTIBLE);
+			schedule_timeout(LP_TIMEOUT_POLLED);
+			finish_wait(&lp_table[minor].waitq, &wait);
+		}

 		if (signal_pending (current)) {
 			retval = -ERESTARTSYS;
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors <at> lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

Gmane