linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / serial / m32r_sio.c
index e7fe4bb..242a041 100644 (file)
@@ -25,6 +25,7 @@
  *  membase is an 'ioremapped' cookie.  This is compatible with the old
  *  serial.c driver, and is currently the preferred form.
  */
+#include <linux/config.h>
 
 #if defined(CONFIG_SERIAL_M32R_SIO_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
 #define SUPPORT_SYSRQ
@@ -247,17 +248,17 @@ static void sio_error(int *status)
 
 #endif /* CONFIG_SERIAL_M32R_PLDSIO */
 
-static unsigned int sio_in(struct uart_sio_port *up, int offset)
+static _INLINE_ unsigned int sio_in(struct uart_sio_port *up, int offset)
 {
        return __sio_in(up->port.iobase + offset);
 }
 
-static void sio_out(struct uart_sio_port *up, int offset, int value)
+static _INLINE_ void sio_out(struct uart_sio_port *up, int offset, int value)
 {
        __sio_out(value, up->port.iobase + offset);
 }
 
-static unsigned int serial_in(struct uart_sio_port *up, int offset)
+static _INLINE_ unsigned int serial_in(struct uart_sio_port *up, int offset)
 {
        if (!offset)
                return 0;
@@ -265,7 +266,8 @@ static unsigned int serial_in(struct uart_sio_port *up, int offset)
        return __sio_in(offset);
 }
 
-static void serial_out(struct uart_sio_port *up, int offset, int value)
+static _INLINE_ void
+serial_out(struct uart_sio_port *up, int offset, int value)
 {
        if (!offset)
                return;
@@ -324,8 +326,8 @@ static void m32r_sio_enable_ms(struct uart_port *port)
        serial_out(up, UART_IER, up->ier);
 }
 
-static void receive_chars(struct uart_sio_port *up, int *status,
-                         struct pt_regs *regs)
+static _INLINE_ void receive_chars(struct uart_sio_port *up, int *status,
+       struct pt_regs *regs)
 {
        struct tty_struct *tty = up->port.info->tty;
        unsigned char ch;
@@ -398,7 +400,7 @@ static void receive_chars(struct uart_sio_port *up, int *status,
        tty_flip_buffer_push(tty);
 }
 
-static void transmit_chars(struct uart_sio_port *up)
+static _INLINE_ void transmit_chars(struct uart_sio_port *up)
 {
        struct circ_buf *xmit = &up->port.info->xmit;
        int count;
@@ -542,7 +544,7 @@ static void serial_do_unlink(struct irq_info *i, struct uart_sio_port *up)
 static int serial_link_irq_chain(struct uart_sio_port *up)
 {
        struct irq_info *i = irq_lists + up->port.irq;
-       int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0;
+       int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? SA_SHIRQ : 0;
 
        spin_lock_irq(&i->lock);
 
@@ -1037,14 +1039,6 @@ static inline void wait_for_xmitr(struct uart_sio_port *up)
        }
 }
 
-static void m32r_sio_console_putchar(struct uart_port *port, int ch)
-{
-       struct uart_sio_port *up = (struct uart_sio_port *)port;
-
-       wait_for_xmitr(up);
-       sio_out(up, SIOTXB, ch);
-}
-
 /*
  *     Print a string to the serial port trying not to disturb
  *     any possible real use of the port...
@@ -1056,6 +1050,7 @@ static void m32r_sio_console_write(struct console *co, const char *s,
 {
        struct uart_sio_port *up = &m32r_sio_ports[co->index];
        unsigned int ier;
+       int i;
 
        /*
         *      First save the UER then disable the interrupts
@@ -1063,7 +1058,23 @@ static void m32r_sio_console_write(struct console *co, const char *s,
        ier = sio_in(up, SIOTRCR);
        sio_out(up, SIOTRCR, 0);
 
-       uart_console_write(&up->port, s, count, m32r_sio_console_putchar);
+       /*
+        *      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, SIOTXB, *s);
+
+               if (*s == 10) {
+                       wait_for_xmitr(up);
+                       sio_out(up, SIOTXB, 13);
+               }
+       }
 
        /*
         *      Finally, wait for transmitter to become empty
@@ -1130,6 +1141,7 @@ console_initcall(m32r_sio_console_init);
 static struct uart_driver m32r_sio_reg = {
        .owner                  = THIS_MODULE,
        .driver_name            = "sio",
+       .devfs_name             = "tts/",
        .dev_name               = "ttyS",
        .major                  = TTY_MAJOR,
        .minor                  = 64,