Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
[pandora-kernel.git] / drivers / serial / sunsab.c
index dc673e1..145d623 100644 (file)
@@ -108,8 +108,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 +160,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 +207,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 +300,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 +320,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 +349,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 +786,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 +885,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 +1037,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;
                }
@@ -1056,7 +1065,8 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id *
                              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;
@@ -1074,10 +1084,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));
 }