reiserfs: add locking around error buffer
[safe/jmp/linux-2.6] / drivers / serial / sa1100.c
index 1bd9316..b24a25e 100644 (file)
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- *  $Id: sa1100.c,v 1.50 2002/07/29 14:41:04 rmk Exp $
- *
  */
-#include <linux/config.h>
 
 #if defined(CONFIG_SERIAL_SA1100_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
 #define SUPPORT_SYSRQ
@@ -43,7 +39,7 @@
 
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/hardware.h>
+#include <mach/hardware.h>
 #include <asm/mach/serial_sa1100.h>
 
 /* We've been assigned a range on the "Low-density serial ports" major */
@@ -191,9 +187,9 @@ static void sa1100_enable_ms(struct uart_port *port)
 }
 
 static void
-sa1100_rx_chars(struct sa1100_port *sport, struct pt_regs *regs)
+sa1100_rx_chars(struct sa1100_port *sport)
 {
-       struct tty_struct *tty = sport->port.info->tty;
+       struct tty_struct *tty = sport->port.info->port.tty;
        unsigned int status, ch, flg;
 
        status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |
@@ -229,7 +225,7 @@ sa1100_rx_chars(struct sa1100_port *sport, struct pt_regs *regs)
 #endif
                }
 
-               if (uart_handle_sysrq_char(&sport->port, ch, regs))
+               if (uart_handle_sysrq_char(&sport->port, ch))
                        goto ignore_char;
 
                uart_insert_char(&sport->port, status, UTSR1_TO_SM(UTSR1_ROR), ch, flg);
@@ -282,7 +278,7 @@ static void sa1100_tx_chars(struct sa1100_port *sport)
                sa1100_stop_tx(&sport->port);
 }
 
-static irqreturn_t sa1100_int(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t sa1100_int(int irq, void *dev_id)
 {
        struct sa1100_port *sport = dev_id;
        unsigned int status, pass_counter = 0;
@@ -295,7 +291,7 @@ static irqreturn_t sa1100_int(int irq, void *dev_id, struct pt_regs *regs)
                        /* Clear the receiver idle bit, if set */
                        if (status & UTSR0_RID)
                                UART_PUT_UTSR0(sport, UTSR0_RID);
-                       sa1100_rx_chars(sport, regs);
+                       sa1100_rx_chars(sport);
                }
 
                /* Clear the relevant break bits */
@@ -409,8 +405,8 @@ static void sa1100_shutdown(struct uart_port *port)
 }
 
 static void
-sa1100_set_termios(struct uart_port *port, struct termios *termios,
-                  struct termios *old)
+sa1100_set_termios(struct uart_port *port, struct ktermios *termios,
+                  struct ktermios *old)
 {
        struct sa1100_port *sport = (struct sa1100_port *)port;
        unsigned long flags;
@@ -628,7 +624,7 @@ static void __init sa1100_init_ports(void)
                sa1100_ports[i].port.ops       = &sa1100_pops;
                sa1100_ports[i].port.fifosize  = 8;
                sa1100_ports[i].port.line      = i;
-               sa1100_ports[i].port.iotype    = SERIAL_IO_MEM;
+               sa1100_ports[i].port.iotype    = UPIO_MEM;
                init_timer(&sa1100_ports[i].timer);
                sa1100_ports[i].timer.function = sa1100_timeout;
                sa1100_ports[i].timer.data     = (unsigned long)&sa1100_ports[i];
@@ -656,7 +652,7 @@ void __init sa1100_register_uart_fns(struct sa1100_port_fns *fns)
 void __init sa1100_register_uart(int idx, int port)
 {
        if (idx >= NR_PORTS) {
-               printk(KERN_ERR "%s: bad index number %d\n", __FUNCTION__, idx);
+               printk(KERN_ERR "%s: bad index number %d\n", __func__, idx);
                return;
        }
 
@@ -665,30 +661,38 @@ void __init sa1100_register_uart(int idx, int port)
                sa1100_ports[idx].port.membase = (void __iomem *)&Ser1UTCR0;
                sa1100_ports[idx].port.mapbase = _Ser1UTCR0;
                sa1100_ports[idx].port.irq     = IRQ_Ser1UART;
-               sa1100_ports[idx].port.flags   = ASYNC_BOOT_AUTOCONF;
+               sa1100_ports[idx].port.flags   = UPF_BOOT_AUTOCONF;
                break;
 
        case 2:
                sa1100_ports[idx].port.membase = (void __iomem *)&Ser2UTCR0;
                sa1100_ports[idx].port.mapbase = _Ser2UTCR0;
                sa1100_ports[idx].port.irq     = IRQ_Ser2ICP;
-               sa1100_ports[idx].port.flags   = ASYNC_BOOT_AUTOCONF;
+               sa1100_ports[idx].port.flags   = UPF_BOOT_AUTOCONF;
                break;
 
        case 3:
                sa1100_ports[idx].port.membase = (void __iomem *)&Ser3UTCR0;
                sa1100_ports[idx].port.mapbase = _Ser3UTCR0;
                sa1100_ports[idx].port.irq     = IRQ_Ser3UART;
-               sa1100_ports[idx].port.flags   = ASYNC_BOOT_AUTOCONF;
+               sa1100_ports[idx].port.flags   = UPF_BOOT_AUTOCONF;
                break;
 
        default:
-               printk(KERN_ERR "%s: bad port number %d\n", __FUNCTION__, port);
+               printk(KERN_ERR "%s: bad port number %d\n", __func__, port);
        }
 }
 
 
 #ifdef CONFIG_SERIAL_SA1100_CONSOLE
+static void sa1100_console_putchar(struct uart_port *port, int ch)
+{
+       struct sa1100_port *sport = (struct sa1100_port *)port;
+
+       while (!(UART_GET_UTSR1(sport) & UTSR1_TNF))
+               barrier();
+       UART_PUT_CHAR(sport, ch);
+}
 
 /*
  * Interrupts are disabled on entering
@@ -697,7 +701,7 @@ static void
 sa1100_console_write(struct console *co, const char *s, unsigned int count)
 {
        struct sa1100_port *sport = &sa1100_ports[co->index];
-       unsigned int old_utcr3, status, i;
+       unsigned int old_utcr3, status;
 
        /*
         *      First, save UTCR3 and then disable interrupts
@@ -706,21 +710,7 @@ sa1100_console_write(struct console *co, const char *s, unsigned int count)
        UART_PUT_UTCR3(sport, (old_utcr3 & ~(UTCR3_RIE | UTCR3_TIE)) |
                                UTCR3_TXE);
 
-       /*
-        *      Now, do each character
-        */
-       for (i = 0; i < count; i++) {
-               do {
-                       status = UART_GET_UTSR1(sport);
-               } while (!(status & UTSR1_TNF));
-               UART_PUT_CHAR(sport, s[i]);
-               if (s[i] == '\n') {
-                       do {
-                               status = UART_GET_UTSR1(sport);
-                       } while (!(status & UTSR1_TNF));
-                       UART_PUT_CHAR(sport, '\r');
-               }
-       }
+       uart_console_write(&sport->port, s, count, sa1100_console_putchar);
 
        /*
         *      Finally, wait for transmitter to become empty
@@ -822,7 +812,6 @@ static struct uart_driver sa1100_reg = {
        .owner                  = THIS_MODULE,
        .driver_name            = "ttySA",
        .dev_name               = "ttySA",
-       .devfs_name             = "ttySA",
        .major                  = SERIAL_SA1100_MAJOR,
        .minor                  = MINOR_START,
        .nr                     = NR_PORTS,
@@ -892,6 +881,7 @@ static struct platform_driver sa11x0_serial_driver = {
        .resume         = sa1100_serial_resume,
        .driver         = {
                .name   = "sa11x0-uart",
+               .owner  = THIS_MODULE,
        },
 };
 
@@ -899,7 +889,7 @@ static int __init sa1100_serial_init(void)
 {
        int ret;
 
-       printk(KERN_INFO "Serial: SA11x0 driver $Revision: 1.50 $\n");
+       printk(KERN_INFO "Serial: SA11x0 driver\n");
 
        sa1100_init_ports();
 
@@ -922,6 +912,7 @@ module_init(sa1100_serial_init);
 module_exit(sa1100_serial_exit);
 
 MODULE_AUTHOR("Deep Blue Solutions Ltd");
-MODULE_DESCRIPTION("SA1100 generic serial port driver $Revision: 1.50 $");
+MODULE_DESCRIPTION("SA1100 generic serial port driver");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_SA1100_MAJOR);
+MODULE_ALIAS("platform:sa11x0-uart");