]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/serial/sunsab.c
i386: fix early usage of atomic_add_return and local_add_return on real i386
[linux-2.6-omap-h63xx.git] / drivers / serial / sunsab.c
index 0dbd4df44c05140499f03bbcb8e2d33be236d3fa..deb9ab4b5a0b6b53c3167c842a833e71d4fcc4fe 100644 (file)
@@ -17,7 +17,6 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
@@ -108,8 +107,7 @@ static __inline__ void sunsab_cec_wait(struct uart_sunsab_port *up)
 
 static struct tty_struct *
 receive_chars(struct uart_sunsab_port *up,
-             union sab82532_irq_status *stat,
-             struct pt_regs *regs)
+             union sab82532_irq_status *stat)
 {
        struct tty_struct *tty = NULL;
        unsigned char buf[32];
@@ -161,7 +159,7 @@ receive_chars(struct uart_sunsab_port *up,
                unsigned char ch = buf[i], flag;
 
                if (tty == NULL) {
-                       uart_handle_sysrq_char(&up->port, ch, regs);
+                       uart_handle_sysrq_char(&up->port, ch);
                        continue;
                }
 
@@ -208,7 +206,7 @@ receive_chars(struct uart_sunsab_port *up,
                                flag = TTY_FRAME;
                }
 
-               if (uart_handle_sysrq_char(&up->port, ch, regs))
+               if (uart_handle_sysrq_char(&up->port, ch))
                        continue;
 
                if ((stat->sreg.isr0 & (up->port.ignore_status_mask & 0xff)) == 0 &&
@@ -301,7 +299,7 @@ static void check_status(struct uart_sunsab_port *up,
        wake_up_interruptible(&up->port.info->delta_msr_wait);
 }
 
-static irqreturn_t sunsab_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t sunsab_interrupt(int irq, void *dev_id)
 {
        struct uart_sunsab_port *up = dev_id;
        struct tty_struct *tty;
@@ -321,7 +319,7 @@ static irqreturn_t sunsab_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                if ((status.sreg.isr0 & (SAB82532_ISR0_TCD | SAB82532_ISR0_TIME |
                                         SAB82532_ISR0_RFO | SAB82532_ISR0_RPF)) ||
                    (status.sreg.isr1 & SAB82532_ISR1_BRK))
-                       tty = receive_chars(up, &status, regs);
+                       tty = receive_chars(up, &status);
                if ((status.sreg.isr0 & SAB82532_ISR0_CDSC) ||
                    (status.sreg.isr1 & SAB82532_ISR1_CSC))
                        check_status(up, &status);
@@ -350,7 +348,7 @@ static irqreturn_t sunsab_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                                         SAB82532_ISR0_RFO | SAB82532_ISR0_RPF)) ||
                    (status.sreg.isr1 & SAB82532_ISR1_BRK))
 
-                       tty = receive_chars(up, &status, regs);
+                       tty = receive_chars(up, &status);
                if ((status.sreg.isr0 & SAB82532_ISR0_CDSC) ||
                    (status.sreg.isr1 & (SAB82532_ISR1_BRK | SAB82532_ISR1_CSC)))
                        check_status(up, &status);
@@ -787,8 +785,8 @@ static void sunsab_convert_to_sab(struct uart_sunsab_port *up, unsigned int cfla
 }
 
 /* port->lock is not held.  */
-static void sunsab_set_termios(struct uart_port *port, struct termios *termios,
-                              struct termios *old)
+static void sunsab_set_termios(struct uart_port *port, struct ktermios *termios,
+                              struct ktermios *old)
 {
        struct uart_sunsab_port *up = (struct uart_sunsab_port *) port;
        unsigned long flags;
@@ -886,6 +884,15 @@ static int sunsab_console_setup(struct console *con, char *options)
        unsigned long flags;
        unsigned int baud, quot;
 
+       /*
+        * The console framework calls us for each and every port
+        * registered. Defer the console setup until the requested
+        * port has been properly discovered. A bit of a hack,
+        * though...
+        */
+       if (up->port.type != PORT_SUNSAB)
+               return -1;
+
        printk("Console: ttyS%d (SAB82532)\n",
               (sunsab_reg.minor - 64) + con->index);
 
@@ -1029,7 +1036,8 @@ static int __devinit sunsab_init_one(struct uart_sunsab_port *up,
                err = request_irq(up->port.irq, sunsab_interrupt,
                                  IRQF_SHARED, "sab", up);
                if (err) {
-                       of_iounmap(up->port.membase,
+                       of_iounmap(&op->resource[0],
+                                  up->port.membase,
                                   sizeof(union sab82532_async_regs));
                        return err;
                }
@@ -1047,15 +1055,17 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id *
        up = &sunsab_ports[inst * 2];
 
        err = sunsab_init_one(&up[0], op,
-                             sizeof(union sab82532_async_regs),
+                             0,
                              (inst * 2) + 0);
        if (err)
                return err;
 
-       err = sunsab_init_one(&up[0], op, 0,
+       err = sunsab_init_one(&up[1], op,
+                             sizeof(union sab82532_async_regs),
                              (inst * 2) + 1);
        if (err) {
-               of_iounmap(up[0].port.membase,
+               of_iounmap(&op->resource[0],
+                          up[0].port.membase,
                           sizeof(union sab82532_async_regs));
                free_irq(up[0].port.irq, &up[0]);
                return err;
@@ -1073,10 +1083,13 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id *
 
 static void __devexit sab_remove_one(struct uart_sunsab_port *up)
 {
+       struct of_device *op = to_of_device(up->port.dev);
+
        uart_remove_one_port(&sunsab_reg, &up->port);
        if (!(up->port.line & 1))
                free_irq(up->port.irq, up);
-       of_iounmap(up->port.membase,
+       of_iounmap(&op->resource[0],
+                  up->port.membase,
                   sizeof(union sab82532_async_regs));
 }
 
@@ -1117,7 +1130,7 @@ static int __init sunsab_init(void)
        int err;
 
        num_channels = 0;
-       for_each_node_by_name(dp, "su")
+       for_each_node_by_name(dp, "se")
                num_channels += 2;
        for_each_node_by_name(dp, "serial") {
                if (of_device_is_compatible(dp, "sab82532"))