nfsd: fix Documentation typo
[safe/jmp/linux-2.6] / drivers / serial / sn_console.c
index 4b0afc8..9794e0c 100644 (file)
@@ -61,7 +61,7 @@
 #define SN_SAL_BUFFER_SIZE (64 * (1 << 10))
 
 #define SN_SAL_UART_FIFO_DEPTH 16
-#define SN_SAL_UART_FIFO_SPEED_CPS 9600/10
+#define SN_SAL_UART_FIFO_SPEED_CPS (9600/10)
 
 /* sn_transmit_chars() calling args */
 #define TRANSMIT_BUFFERED      0
@@ -361,8 +361,8 @@ static int snp_startup(struct uart_port *port)
  *
  */
 static void
-snp_set_termios(struct uart_port *port, struct termios *termios,
-               struct termios *old)
+snp_set_termios(struct uart_port *port, struct ktermios *termios,
+               struct ktermios *old)
 {
 }
 
@@ -447,7 +447,6 @@ static int sn_debug_printf(const char *fmt, ...)
 /**
  * sn_receive_chars - Grab characters, pass them to tty layer
  * @port: Port to operate on
- * @regs: Saved registers (needed by uart_handle_sysrq_char)
  * @flags: irq flags
  *
  * Note: If we're not registered with the serial core infrastructure yet,
@@ -455,8 +454,7 @@ static int sn_debug_printf(const char *fmt, ...)
  *
  */
 static void
-sn_receive_chars(struct sn_cons_port *port, struct pt_regs *regs,
-                unsigned long flags)
+sn_receive_chars(struct sn_cons_port *port, unsigned long flags)
 {
        int ch;
        struct tty_struct *tty;
@@ -471,9 +469,9 @@ sn_receive_chars(struct sn_cons_port *port, struct pt_regs *regs,
                return;
        }
 
-       if (port->sc_port.info) {
+       if (port->sc_port.state) {
                /* The serial_core stuffs are initilized, use them */
-               tty = port->sc_port.info->tty;
+               tty = port->sc_port.state->port.tty;
        }
        else {
                /* Not registered yet - can't pass to tty layer.  */
@@ -494,7 +492,7 @@ sn_receive_chars(struct sn_cons_port *port, struct pt_regs *regs,
                         sysrq_requested = 0;
                         if (ch && time_before(jiffies, sysrq_timeout)) {
                                 spin_unlock_irqrestore(&port->sc_port.lock, flags);
-                                handle_sysrq(ch, regs, NULL);
+                                handle_sysrq(ch, NULL);
                                 spin_lock_irqsave(&port->sc_port.lock, flags);
                                 /* ignore actual sysrq command char */
                                 continue;
@@ -552,9 +550,9 @@ static void sn_transmit_chars(struct sn_cons_port *port, int raw)
 
        BUG_ON(!port->sc_is_asynch);
 
-       if (port->sc_port.info) {
+       if (port->sc_port.state) {
                /* We're initilized, using serial core infrastructure */
-               xmit = &port->sc_port.info->xmit;
+               xmit = &port->sc_port.state->xmit;
        } else {
                /* Probably sn_sal_switch_to_asynch has been run but serial core isn't
                 * initilized yet.  Just return.  Writes are going through
@@ -615,10 +613,9 @@ static void sn_transmit_chars(struct sn_cons_port *port, int raw)
  * sn_sal_interrupt - Handle console interrupts
  * @irq: irq #, useful for debug statements
  * @dev_id: our pointer to our port (sn_cons_port which contains the uart port)
- * @regs: Saved registers, used by sn_receive_chars for uart_handle_sysrq_char
  *
  */
-static irqreturn_t sn_sal_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t sn_sal_interrupt(int irq, void *dev_id)
 {
        struct sn_cons_port *port = (struct sn_cons_port *)dev_id;
        unsigned long flags;
@@ -629,7 +626,7 @@ static irqreturn_t sn_sal_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
        spin_lock_irqsave(&port->sc_port.lock, flags);
        if (status & SAL_CONSOLE_INTR_RECV) {
-               sn_receive_chars(port, regs, flags);
+               sn_receive_chars(port, flags);
        }
        if (status & SAL_CONSOLE_INTR_XMIT) {
                sn_transmit_chars(port, TRANSMIT_BUFFERED);
@@ -639,25 +636,6 @@ static irqreturn_t sn_sal_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 }
 
 /**
- * sn_sal_connect_interrupt - Request interrupt, handled by sn_sal_interrupt
- * @port: Our sn_cons_port (which contains the uart port)
- *
- * returns the console irq if interrupt is successfully registered, else 0
- *
- */
-static int sn_sal_connect_interrupt(struct sn_cons_port *port)
-{
-       if (request_irq(SGI_UART_VECTOR, sn_sal_interrupt,
-                       SA_INTERRUPT | SA_SHIRQ,
-                       "SAL console driver", port) >= 0) {
-               return SGI_UART_VECTOR;
-       }
-
-       printk(KERN_INFO "sn_console: console proceeding in polled mode\n");
-       return 0;
-}
-
-/**
  * sn_sal_timer_poll - this function handles polled console mode
  * @data: A pointer to our sn_cons_port (which contains the uart port)
  *
@@ -677,7 +655,7 @@ static void sn_sal_timer_poll(unsigned long data)
        if (!port->sc_port.irq) {
                spin_lock_irqsave(&port->sc_port.lock, flags);
                if (sn_process_input)
-                       sn_receive_chars(port, NULL, flags);
+                       sn_receive_chars(port, flags);
                sn_transmit_chars(port, TRANSMIT_RAW);
                spin_unlock_irqrestore(&port->sc_port.lock, flags);
                mod_timer(&port->sc_timer,
@@ -749,30 +727,31 @@ static void __init sn_sal_switch_to_asynch(struct sn_cons_port *port)
  * mode.  We were previously in asynch/polling mode (using init_timer).
  *
  * We attempt to switch to interrupt mode here by calling
- * sn_sal_connect_interrupt.  If that works out, we enable receive interrupts.
+ * request_irq.  If that works out, we enable receive interrupts.
  */
 static void __init sn_sal_switch_to_interrupts(struct sn_cons_port *port)
 {
-       int irq;
        unsigned long flags;
 
-       if (!port)
-               return;
-
-       DPRINTF("sn_console: switching to interrupt driven console\n");
-
-       spin_lock_irqsave(&port->sc_port.lock, flags);
+       if (port) {
+               DPRINTF("sn_console: switching to interrupt driven console\n");
 
-       irq = sn_sal_connect_interrupt(port);
+               if (request_irq(SGI_UART_VECTOR, sn_sal_interrupt,
+                               IRQF_DISABLED | IRQF_SHARED,
+                               "SAL console driver", port) >= 0) {
+                       spin_lock_irqsave(&port->sc_port.lock, flags);
+                       port->sc_port.irq = SGI_UART_VECTOR;
+                       port->sc_ops = &intr_ops;
 
-       if (irq) {
-               port->sc_port.irq = irq;
-               port->sc_ops = &intr_ops;
-
-               /* turn on receive interrupts */
-               ia64_sn_console_intr_enable(SAL_CONSOLE_INTR_RECV);
+                       /* turn on receive interrupts */
+                       ia64_sn_console_intr_enable(SAL_CONSOLE_INTR_RECV);
+                       spin_unlock_irqrestore(&port->sc_port.lock, flags);
+               }
+               else {
+                       printk(KERN_INFO
+                           "sn_console: console proceeding in polled mode\n");
+               }
        }
-       spin_unlock_irqrestore(&port->sc_port.lock, flags);
 }
 
 /*
@@ -780,7 +759,7 @@ static void __init sn_sal_switch_to_interrupts(struct sn_cons_port *port)
  */
 
 static void sn_sal_console_write(struct console *, const char *, unsigned);
-static int __init sn_sal_console_setup(struct console *, char *);
+static int sn_sal_console_setup(struct console *, char *);
 static struct uart_driver sal_console_uart;
 extern struct tty_driver *uart_console_device(struct console *, int *);
 
@@ -860,7 +839,7 @@ static int __init sn_sal_module_init(void)
 
        if (uart_add_one_port(&sal_console_uart, &sal_console_port.sc_port) < 0) {
                /* error - not sure what I'd do - so I'll do nothing */
-               printk(KERN_ERR "%s: unable to add port\n", __FUNCTION__);
+               printk(KERN_ERR "%s: unable to add port\n", __func__);
        }
 
        /* when this driver is compiled in, the console initialization
@@ -948,7 +927,7 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
        /* We can't look at the xmit buffer if we're not registered with serial core
         *  yet.  So only do the fancy recovery after registering
         */
-       if (!port->sc_port.info) {
+       if (!port->sc_port.state) {
                /* Not yet registered with serial core - simple case */
                puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count);
                return;
@@ -957,8 +936,8 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
        /* somebody really wants this output, might be an
         * oops, kdb, panic, etc.  make sure they get it. */
        if (spin_is_locked(&port->sc_port.lock)) {
-               int lhead = port->sc_port.info->xmit.head;
-               int ltail = port->sc_port.info->xmit.tail;
+               int lhead = port->sc_port.state->xmit.head;
+               int ltail = port->sc_port.state->xmit.tail;
                int counter, got_lock = 0;
 
                /*
@@ -983,13 +962,13 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
                                break;
                        } else {
                                /* still locked */
-                               if ((lhead != port->sc_port.info->xmit.head)
+                               if ((lhead != port->sc_port.state->xmit.head)
                                    || (ltail !=
-                                       port->sc_port.info->xmit.tail)) {
+                                       port->sc_port.state->xmit.tail)) {
                                        lhead =
-                                               port->sc_port.info->xmit.head;
+                                               port->sc_port.state->xmit.head;
                                        ltail =
-                                               port->sc_port.info->xmit.tail;
+                                               port->sc_port.state->xmit.tail;
                                        counter = 0;
                                }
                        }
@@ -1027,7 +1006,7 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
  * here so providing it is easier.
  *
  */
-static int __init sn_sal_console_setup(struct console *co, char *options)
+static int sn_sal_console_setup(struct console *co, char *options)
 {
        return 0;
 }