From bb722553b5f6467eb4acbc3afa2bf4cc7bd60474 Mon Sep 17 00:00:00 2001 From: Harald Koerfgen Date: Sat, 18 Sep 1999 20:48:03 +0000 Subject: o made CVS compile again for R5000 o dz fixes by David Airlie o small zs fix (init is fast again) o #ifdef in softirq.h fixed --- drivers/char/dz.c | 59 ++++++++++++++++--------------------------------------- drivers/char/dz.h | 6 +++--- drivers/tc/zs.c | 2 +- 3 files changed, 21 insertions(+), 46 deletions(-) (limited to 'drivers') diff --git a/drivers/char/dz.c b/drivers/char/dz.c index 30f28280b..396c59167 100644 --- a/drivers/char/dz.c +++ b/drivers/char/dz.c @@ -14,6 +14,9 @@ * after patches by harald to irq code. * [09-JAN-99] triemer minor fix for schedule - due to removal of timeout * field from "current" - somewhere between 2.1.121 and 2.1.131 + * + * Parts (C) 1999 David Airlie, airlied@linux.ie + * [07-SEP-99] Bugfixes */ #ifdef MODULE @@ -74,7 +77,7 @@ extern int (*prom_printf) (char *,...); DECLARE_TASK_QUEUE(tq_serial); -extern struct wait_queue *keypress_wait; +extern wait_queue_head_t keypress_wait; static struct dz_serial *lines[4]; static unsigned char tmp_buffer[256]; @@ -131,9 +134,13 @@ static inline void dz_out (struct dz_serial *info, unsigned offset, unsigned sho static void dz_stop (struct tty_struct *tty) { - struct dz_serial *info = (struct dz_serial *)tty->driver_data; + struct dz_serial *info; unsigned short mask, tmp; + if (tty==0) + return; + + info = (struct dz_serial *)tty->driver_data; mask = 1 << info->line; tmp = dz_in (info, DZ_TCR); /* read the TX flag */ @@ -1040,7 +1047,7 @@ static void dz_close (struct tty_struct *tty, struct file *filp) } if (--info->count < 0) { - printk("rs_close: bad serial port count for ttys%d: %d\n", + printk("ds_close: bad serial port count for ttys%d: %d\n", info->line, info->count); info->count = 0; } @@ -1127,7 +1134,7 @@ static void dz_hangup (struct tty_struct *tty) */ static int block_til_ready (struct tty_struct *tty, struct file *filp, struct dz_serial *info) { - struct wait_queue wait = { current, NULL }; + DECLARE_WAITQUEUE(wait, current); int retval; int do_clocal = 0; @@ -1339,9 +1346,9 @@ __initfunc(int dz_init(void)) panic("Couldn't register callout driver\n"); save_flags(flags); cli(); - i = 0; - for (info = &multi[i]; i < DZ_NB_PORT; i++) + for (i=0; i < DZ_NB_PORT; i++) { + info = &multi[i]; lines[i] = info; info->magic = SERIAL_MAGIC; @@ -1364,8 +1371,8 @@ __initfunc(int dz_init(void)) info->tqueue_hangup.data = info; info->callout_termios = callout_driver.init_termios; info->normal_termios = serial_driver.init_termios; - info->open_wait = 0; - info->close_wait = 0; + init_waitqueue_head(&info->open_wait); + init_waitqueue_head(&info->close_wait); /* If we are pointing to address zero then punt - not correctly set up in setup.c to handle this. */ @@ -1400,7 +1407,7 @@ __initfunc(int dz_init(void)) #ifdef CONFIG_SERIAL_CONSOLE static void dz_console_put_char (unsigned char ch) { - long flags; + unsigned long flags; int loops = 2500; unsigned short tmp = ch; /* this code sends stuff out to serial device - spinning its @@ -1414,7 +1421,7 @@ static void dz_console_put_char (unsigned char ch) /* spin our wheels */ - while (((dz_in(dz_console,DZ_TCR) & DZ_TRDY) != DZ_TRDY) && loops--) + while (((dz_in(dz_console,DZ_CSR) & DZ_TRDY) != DZ_TRDY) && loops--) ; /* Actually transmit the character. */ @@ -1533,38 +1540,6 @@ __initfunc(static int dz_console_setup(struct console *co, char *options)) dz_console->cflags |= DZ_PARENB; dz_out (dz_console, DZ_LPR, dz_console->cflags); - - mask = 1 << dz_console->line; - tmp = dz_in (dz_console, DZ_TCR); /* read the TX flag */ - if (!(tmp & mask)) { - tmp |= mask; /* set the TX flag */ - dz_out (dz_console, DZ_TCR, tmp); - } - - - /* TOFIX: force to console line */ - dz_console = &multi[CONSOLE_LINE]; - if ((mips_machtype == MACH_DS23100) || (mips_machtype == MACH_DS5100)) - dz_console->port = KN01_DZ11_BASE; - else - dz_console->port = KN02_DZ11_BASE; - dz_console->line = CONSOLE_LINE; - - dz_out(dz_console, DZ_CSR, DZ_CLR); - while ((tmp = dz_in(dz_console,DZ_CSR)) & DZ_CLR) - ; - - /* enable scanning */ - dz_out(dz_console, DZ_CSR, DZ_MSE); - - /* Set up flags... */ - dz_console->cflags = 0; - dz_console->cflags |= DZ_B9600; - dz_console->cflags |= DZ_CS8; - dz_console->cflags |= DZ_PARENB; - dz_out (dz_console, DZ_LPR, dz_console->cflags); - - mask = 1 << dz_console->line; tmp = dz_in (dz_console, DZ_TCR); /* read the TX flag */ if (!(tmp & mask)) { diff --git a/drivers/char/dz.h b/drivers/char/dz.h index 1b986d908..bf106e1ea 100644 --- a/drivers/char/dz.h +++ b/drivers/char/dz.h @@ -158,8 +158,8 @@ struct dz_serial { struct tq_struct tqueue_hangup; struct termios normal_termios; struct termios callout_termios; - struct wait_queue *open_wait; - struct wait_queue *close_wait; + wait_queue_head_t open_wait; + wait_queue_head_t close_wait; long session; /* Session of opening process */ long pgrp; /* pgrp of opening process */ @@ -188,7 +188,7 @@ static int serial_refcount; * memory if large numbers of serial ports are open. */ static unsigned char *tmp_buf; -static struct semaphore tmp_buf_sem = MUTEX; +static DECLARE_MUTEX(tmp_buf_sem); static char *dz_name = "DECstation DZ serial driver version "; static char *dz_version = "1.02"; diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c index 667387bc8..f22b17ac5 100644 --- a/drivers/tc/zs.c +++ b/drivers/tc/zs.c @@ -1314,7 +1314,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout) char_time = 1; if (timeout) char_time = MIN(char_time, timeout); - while ((read_zsreg(info->zs_channel, 1) & ALL_SNT) == 0) { + while ((read_zsreg(info->zs_channel, 1) & Tx_BUF_EMP) == 0) { current->state = TASK_INTERRUPTIBLE; current->counter = 0; /* make us low-priority */ schedule_timeout(char_time); -- cgit v1.2.3