[PATCH] tty: switch to ktermios
[safe/jmp/linux-2.6] / drivers / serial / mux.c
index 36e3bcb..ccb8fa1 100644 (file)
@@ -16,7 +16,6 @@
 **
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/tty.h>
 #include <linux/ioport.h>
@@ -51,7 +50,7 @@
 #define MUX_BREAK(status) ((status & 0xF000) == 0x2000)
 
 #define MUX_NR 256
-static unsigned int port_cnt = 0;
+static unsigned int port_cnt __read_mostly;
 static struct uart_port mux_ports[MUX_NR];
 
 static struct uart_driver mux_driver = {
@@ -223,11 +222,6 @@ static void mux_read(struct uart_port *port)
                if (MUX_EOFIFO(data))
                        break;
 
-               if (tty->flip.count >= TTY_FLIPBUF_SIZE)
-                       continue;
-
-               *tty->flip.char_buf_ptr = data & 0xffu;
-               *tty->flip.flag_buf_ptr = TTY_NORMAL;
                port->icount.rx++;
 
                if (MUX_BREAK(data)) {
@@ -236,12 +230,10 @@ static void mux_read(struct uart_port *port)
                                continue;
                }
 
-               if (uart_handle_sysrq_char(port, data & 0xffu, NULL))
+               if (uart_handle_sysrq_char(port, data & 0xffu))
                        continue;
 
-               tty->flip.flag_buf_ptr++;
-               tty->flip.char_buf_ptr++;
-               tty->flip.count++;
+               tty_insert_flip_char(tty, data & 0xFF, TTY_NORMAL);
        }
        
        if (start_count != port->icount.rx) {
@@ -281,8 +273,8 @@ static void mux_shutdown(struct uart_port *port)
  * The Serial Mux does not support this function.
  */
 static void
-mux_set_termios(struct uart_port *port, struct termios *termios,
-               struct termios *old)
+mux_set_termios(struct uart_port *port, struct ktermios *termios,
+               struct ktermios *old)
 {
 }
 
@@ -468,8 +460,8 @@ static int __init mux_probe(struct parisc_device *dev)
                port->iobase    = 0;
                port->mapbase   = dev->hpa.start + MUX_OFFSET +
                                                (i * MUX_LINE_OFFSET);
-               port->membase   = ioremap(port->mapbase, MUX_LINE_OFFSET);
-               port->iotype    = SERIAL_IO_MEM;
+               port->membase   = ioremap_nocache(port->mapbase, MUX_LINE_OFFSET);
+               port->iotype    = UPIO_MEM;
                port->type      = PORT_MUX;
                port->irq       = NO_IRQ;
                port->uartclk   = 0;
@@ -477,6 +469,13 @@ static int __init mux_probe(struct parisc_device *dev)
                port->ops       = &mux_pops;
                port->flags     = UPF_BOOT_AUTOCONF;
                port->line      = port_cnt;
+
+               /* The port->timeout needs to match what is present in
+                * uart_wait_until_sent in serial_core.c.  Otherwise
+                * the time spent in msleep_interruptable will be very
+                * long, causing the appearance of a console hang.
+                */
+               port->timeout   = HZ / 50;
                spin_lock_init(&port->lock);
                status = uart_add_one_port(&mux_driver, port);
                BUG_ON(status);
@@ -522,6 +521,8 @@ static void __exit mux_exit(void)
 
        for (i = 0; i < port_cnt; i++) {
                uart_remove_one_port(&mux_driver, &mux_ports[i]);
+               if (mux_ports[i].membase)
+                       iounmap(mux_ports[i].membase);
        }
 
        uart_unregister_driver(&mux_driver);