[SPARC64]: Prevent registering wrong serial console.
[safe/jmp/linux-2.6] / drivers / serial / sunsu.c
index bc67442..3313cb2 100644 (file)
@@ -109,11 +109,11 @@ static _INLINE_ unsigned int serial_in(struct uart_sunsu_port *up, int offset)
        offset <<= up->port.regshift;
 
        switch (up->port.iotype) {
-       case SERIAL_IO_HUB6:
+       case UPIO_HUB6:
                outb(up->port.hub6 - 1 + offset, up->port.iobase);
                return inb(up->port.iobase + 1);
 
-       case SERIAL_IO_MEM:
+       case UPIO_MEM:
                return readb(up->port.membase + offset);
 
        default:
@@ -139,12 +139,12 @@ serial_out(struct uart_sunsu_port *up, int offset, int value)
        offset <<= up->port.regshift;
 
        switch (up->port.iotype) {
-       case SERIAL_IO_HUB6:
+       case UPIO_HUB6:
                outb(up->port.hub6 - 1 + offset, up->port.iobase);
                outb(value, up->port.iobase + 1);
                break;
 
-       case SERIAL_IO_MEM:
+       case UPIO_MEM:
                writeb(value, up->port.membase + offset);
                break;
 
@@ -299,13 +299,10 @@ static void sunsu_start_tx(struct uart_port *port)
 static void sunsu_stop_rx(struct uart_port *port)
 {
        struct uart_sunsu_port *up = (struct uart_sunsu_port *) port;
-       unsigned long flags;
 
-       spin_lock_irqsave(&up->port.lock, flags);
        up->ier &= ~UART_IER_RLSI;
        up->port.read_status_mask &= ~UART_LSR_DR;
        serial_out(up, UART_IER, up->ier);
-       spin_unlock_irqrestore(&up->port.lock, flags);
 }
 
 static void sunsu_enable_ms(struct uart_port *port)
@@ -1052,7 +1049,7 @@ static void sunsu_autoconfig(struct uart_sunsu_port *up)
                return;
 
        up->type_probed = PORT_UNKNOWN;
-       up->port.iotype = SERIAL_IO_MEM;
+       up->port.iotype = UPIO_MEM;
 
        /*
         * First we look for Ebus-bases su's
@@ -1467,18 +1464,17 @@ static struct console sunsu_cons = {
        .index  =       -1,
        .data   =       &sunsu_reg,
 };
-#define SUNSU_CONSOLE  (&sunsu_cons)
 
 /*
  *     Register console.
  */
 
-static int __init sunsu_serial_console_init(void)
+static inline struct console *SUNSU_CONSOLE(void)
 {
        int i;
 
        if (con_is_present())
-               return 0;
+               return NULL;
 
        for (i = 0; i < UART_NR; i++) {
                int this_minor = sunsu_reg.minor + i;
@@ -1487,16 +1483,16 @@ static int __init sunsu_serial_console_init(void)
                        break;
        }
        if (i == UART_NR)
-               return 0;
+               return NULL;
        if (sunsu_ports[i].port_node == 0)
-               return 0;
+               return NULL;
 
        sunsu_cons.index = i;
-       register_console(&sunsu_cons);
-       return 0;
+
+       return &sunsu_cons;
 }
 #else
-#define SUNSU_CONSOLE                  (NULL)
+#define SUNSU_CONSOLE()                        (NULL)
 #define sunsu_serial_console_init()    do { } while (0)
 #endif
 
@@ -1526,16 +1522,17 @@ static int __init sunsu_serial_init(void)
        }
 
        sunsu_reg.minor = sunserial_current_minor;
-       sunserial_current_minor += instance;
 
        sunsu_reg.nr = instance;
-       sunsu_reg.cons = SUNSU_CONSOLE;
 
        ret = uart_register_driver(&sunsu_reg);
        if (ret < 0)
                return ret;
 
-       sunsu_serial_console_init();
+       sunserial_current_minor += instance;
+
+       sunsu_reg.cons = SUNSU_CONSOLE();
+
        for (i = 0; i < UART_NR; i++) {
                struct uart_sunsu_port *up = &sunsu_ports[i];