patch-2.2.0-pre3 linux/drivers/char/lp_m68k.c

Next file: linux/drivers/char/pms.c
Previous file: linux/drivers/char/cyclades.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.0-pre2/linux/drivers/char/lp_m68k.c linux/drivers/char/lp_m68k.c
@@ -41,8 +41,8 @@
 #include <linux/major.h>
 #include <linux/sched.h>
 #include <linux/string.h>
+#include <linux/timer.h>
 #include <linux/init.h>
-#include <asm/irq.h>
 #ifdef CONFIG_KMOD
 #include <linux/kmod.h>
 #endif
@@ -58,6 +58,7 @@
 #include <linux/malloc.h>
 #include <linux/interrupt.h>
 
+#include <asm/irq.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
 
@@ -183,6 +184,7 @@
   struct inode *inode = file->f_dentry->d_inode;
   unsigned long total_bytes_written = 0;
   unsigned int flags;
+  long timeout;
   int rc;
   int dev = MINOR(inode->i_rdev);
 
@@ -211,12 +213,12 @@
 	  /* something blocked printing, so we don't want to sleep too long,
 	     in case we have to rekick the interrupt */
 
-	  current->timeout = jiffies + LP_TIMEOUT_POLLED;
+	  timeout = LP_TIMEOUT_POLLED;
       } else {
-	  current->timeout = jiffies + LP_TIMEOUT_INTERRUPT;
+	  timeout = LP_TIMEOUT_INTERRUPT;
       }
   
-      interruptible_sleep_on(&lp_table[dev]->lp_wait_q);
+      interruptible_sleep_on_timeout(&lp_table[dev]->lp_wait_q, timeout);
       restore_flags(flags);
   
       /* we're up again and running. we first disable lp_interrupt(), then
@@ -281,7 +283,7 @@
 	int dev = MINOR(inode->i_rdev);
 
 #ifdef LP_DEBUG
-	if (jiffies-lp_last_call > lp_table[dev]->time) {
+	if (time_after(jiffies, lp_last_call + lp_table[dev]->time)) {
 		lp_total_chars = 0;
 		lp_max_count = 1;
 	}
@@ -336,8 +338,7 @@
 			lp_total_chars = 0;
 #endif
 			current->state = TASK_INTERRUPTIBLE;
-			current->timeout = jiffies + timeout;
-			schedule();
+			schedule_timeout(timeout);
 		}
 	}
 	return temp - buf;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov