Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6
[pandora-kernel.git] / drivers / serial / sunsu.c
index 96a852a..26d720b 100644 (file)
@@ -1288,7 +1288,17 @@ static void sunsu_console_write(struct console *co, const char *s,
                                unsigned int count)
 {
        struct uart_sunsu_port *up = &sunsu_ports[co->index];
+       unsigned long flags;
        unsigned int ier;
+       int locked = 1;
+
+       local_irq_save(flags);
+       if (up->port.sysrq) {
+               locked = 0;
+       } else if (oops_in_progress) {
+               locked = spin_trylock(&up->port.lock);
+       } else
+               spin_lock(&up->port.lock);
 
        /*
         *      First save the UER then disable the interrupts
@@ -1304,6 +1314,10 @@ static void sunsu_console_write(struct console *co, const char *s,
         */
        wait_for_xmitr(up);
        serial_out(up, UART_IER, ier);
+
+       if (locked)
+               spin_unlock(&up->port.lock);
+       local_irq_restore(flags);
 }
 
 /*
@@ -1312,7 +1326,7 @@ static void sunsu_console_write(struct console *co, const char *s,
  *     - initialize the serial port
  *     Return non-zero if we didn't find a serial port.
  */
-static int sunsu_console_setup(struct console *co, char *options)
+static int __init sunsu_console_setup(struct console *co, char *options)
 {
        struct uart_port *port;
        int baud = 9600;
@@ -1343,7 +1357,7 @@ static int sunsu_console_setup(struct console *co, char *options)
        return uart_set_options(port, co, baud, parity, bits, flow);
 }
 
-static struct console sunsu_cons = {
+static struct console sunsu_console = {
        .name   =       "ttyS",
        .write  =       sunsu_console_write,
        .device =       uart_console_device,
@@ -1373,9 +1387,9 @@ static inline struct console *SUNSU_CONSOLE(int num_uart)
        if (i == num_uart)
                return NULL;
 
-       sunsu_cons.index = i;
+       sunsu_console.index = i;
 
-       return &sunsu_cons;
+       return &sunsu_console;
 }
 #else
 #define SUNSU_CONSOLE(num_uart)                (NULL)
@@ -1387,8 +1401,8 @@ static enum su_type __devinit su_get_type(struct device_node *dp)
        struct device_node *ap = of_find_node_by_path("/aliases");
 
        if (ap) {
-               char *keyb = of_get_property(ap, "keyboard", NULL);
-               char *ms = of_get_property(ap, "mouse", NULL);
+               const char *keyb = of_get_property(ap, "keyboard", NULL);
+               const char *ms = of_get_property(ap, "mouse", NULL);
 
                if (keyb) {
                        if (dp == of_find_node_by_path(keyb))