diff options
Diffstat (limited to 'drivers/char/lp_m68k.c')
-rw-r--r-- | drivers/char/lp_m68k.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/char/lp_m68k.c b/drivers/char/lp_m68k.c index 2660c2ca2..7eecf2965 100644 --- a/drivers/char/lp_m68k.c +++ b/drivers/char/lp_m68k.c @@ -41,11 +41,9 @@ #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 #ifdef CONFIG_AMIGA #ifdef CONFIG_MULTIFACE_III_LP @@ -58,6 +56,7 @@ #include <linux/malloc.h> #include <linux/interrupt.h> +#include <asm/irq.h> #include <asm/uaccess.h> #include <asm/system.h> @@ -183,6 +182,7 @@ static ssize_t lp_write_interrupt(struct file *file, const char *buf, 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 +211,12 @@ static ssize_t lp_write_interrupt(struct file *file, const char *buf, /* 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 +281,7 @@ static ssize_t lp_write_polled(struct file *file, const char *buf, 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 +336,7 @@ static ssize_t lp_write_polled(struct file *file, const char *buf, lp_total_chars = 0; #endif current->state = TASK_INTERRUPTIBLE; - current->timeout = jiffies + timeout; - schedule(); + schedule_timeout(timeout); } } return temp - buf; @@ -373,14 +372,12 @@ static int lp_open(struct inode *inode, struct file *file) if (dev >= MAX_LP) goto out_err; -#ifdef CONFIG_KMOD if (!lp_table[dev]) { char modname[30]; sprintf(modname, "char-major-%d-%d", LP_MAJOR, dev); request_module(modname); } -#endif if (!lp_table[dev]) goto out_err; if (!(lp_table[dev]->flags & LP_EXIST)) @@ -530,7 +527,7 @@ void cleanup_module(void) * (un-)register for hardware drivers * tab is an inititalised lp_struct, dev the desired minor * if dev < 0, let the driver choose the first free minor - * if sucessful return the minor, else -1 + * if successful return the minor, else -1 */ int register_parallel(struct lp_struct *tab, int dev) { |