]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/serial/serial_txx9.c
[SERIAL] kernel console should send CRLF not LFCR
[mv-sheeva.git] / drivers / serial / serial_txx9.c
index f10c86d60b647fb8dedad8423d7f507920d3b705..1a259cee1a986854da0aa4de1563829261a41022 100644 (file)
@@ -52,6 +52,7 @@
 #include <linux/tty_flip.h>
 #include <linux/serial_core.h>
 #include <linux/serial.h>
+#include <linux/mutex.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -303,17 +304,6 @@ receive_chars(struct uart_txx9_port *up, unsigned int *status, struct pt_regs *r
        char flag;
 
        do {
-               /* The following is not allowed by the tty layer and
-                  unsafe. It should be fixed ASAP */
-               if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) {
-                       if (tty->low_latency) {
-                               spin_unlock(&up->port.lock);
-                               tty_flip_buffer_push(tty);
-                               spin_lock(&up->port.lock);
-                       }
-                       /* If this failed then we will throw away the
-                          bytes but must do so to clear interrupts */
-               }
                ch = sio_in(up, TXX9_SIRFIFO);
                flag = TTY_NORMAL;
                up->port.icount.rx++;
@@ -864,6 +854,14 @@ static inline void wait_for_xmitr(struct uart_txx9_port *up)
        }
 }
 
+static void serial_txx9_console_putchar(struct uart_port *port, int ch)
+{
+       struct uart_txx9_port *up = (struct uart_txx9_port *)port;
+
+       wait_for_xmitr(up);
+       sio_out(up, TXX9_SITFIFO, ch);
+}
+
 /*
  *     Print a string to the serial port trying not to disturb
  *     any possible real use of the port...
@@ -875,7 +873,6 @@ serial_txx9_console_write(struct console *co, const char *s, unsigned int count)
 {
        struct uart_txx9_port *up = &serial_txx9_ports[co->index];
        unsigned int ier, flcr;
-       int i;
 
        /*
         *      First save the UER then disable the interrupts
@@ -889,22 +886,7 @@ serial_txx9_console_write(struct console *co, const char *s, unsigned int count)
        if (!(up->port.flags & UPF_CONS_FLOW) && (flcr & TXX9_SIFLCR_TES))
                sio_out(up, TXX9_SIFLCR, flcr & ~TXX9_SIFLCR_TES);
 
-       /*
-        *      Now, do each character
-        */
-       for (i = 0; i < count; i++, s++) {
-               wait_for_xmitr(up);
-
-               /*
-                *      Send the character out.
-                *      If a LF, also do CR...
-                */
-               sio_out(up, TXX9_SITFIFO, *s);
-               if (*s == 10) {
-                       wait_for_xmitr(up);
-                       sio_out(up, TXX9_SITFIFO, 13);
-               }
-       }
+       uart_console_write(&up->port, s, count, serial_txx9_console_putchar);
 
        /*
         *      Finally, wait for transmitter to become empty
@@ -1029,7 +1011,7 @@ static void serial_txx9_resume_port(int line)
        uart_resume_port(&serial_txx9_reg, &serial_txx9_ports[line].port);
 }
 
-static DECLARE_MUTEX(serial_txx9_sem);
+static DEFINE_MUTEX(serial_txx9_mutex);
 
 /**
  *     serial_txx9_register_port - register a serial port
@@ -1048,7 +1030,7 @@ static int __devinit serial_txx9_register_port(struct uart_port *port)
        struct uart_txx9_port *uart;
        int ret = -ENOSPC;
 
-       down(&serial_txx9_sem);
+       mutex_lock(&serial_txx9_mutex);
        for (i = 0; i < UART_NR; i++) {
                uart = &serial_txx9_ports[i];
                if (uart->port.type == PORT_UNKNOWN)
@@ -1069,7 +1051,7 @@ static int __devinit serial_txx9_register_port(struct uart_port *port)
                if (ret == 0)
                        ret = uart->port.line;
        }
-       up(&serial_txx9_sem);
+       mutex_unlock(&serial_txx9_mutex);
        return ret;
 }
 
@@ -1084,7 +1066,7 @@ static void __devexit serial_txx9_unregister_port(int line)
 {
        struct uart_txx9_port *uart = &serial_txx9_ports[line];
 
-       down(&serial_txx9_sem);
+       mutex_lock(&serial_txx9_mutex);
        uart_remove_one_port(&serial_txx9_reg, &uart->port);
        uart->port.flags = 0;
        uart->port.type = PORT_UNKNOWN;
@@ -1093,7 +1075,7 @@ static void __devexit serial_txx9_unregister_port(int line)
        uart->port.membase = 0;
        uart->port.dev = NULL;
        uart_add_one_port(&serial_txx9_reg, &uart->port);
-       up(&serial_txx9_sem);
+       mutex_unlock(&serial_txx9_mutex);
 }
 
 /*
@@ -1195,7 +1177,7 @@ static int __init serial_txx9_init(void)
                serial_txx9_register_ports(&serial_txx9_reg);
 
 #ifdef ENABLE_SERIAL_TXX9_PCI
-               ret = pci_module_init(&serial_txx9_pci_driver);
+               ret = pci_register_driver(&serial_txx9_pci_driver);
 #endif
        }
        return ret;