]> git.neil.brown.name Git - history.git/commitdiff
[SUNSAB]: Fixup sunsab_receive_chars for when serial console isn't open (no tty)
authorBen Collins <bcollins@debian.org>
Wed, 28 Jan 2004 06:12:06 +0000 (01:12 -0500)
committerBen Collins <bmc@hopper.(none)>
Wed, 28 Jan 2004 06:12:06 +0000 (01:12 -0500)
drivers/serial/sunsab.c

index afb27a2b50f3b223126cee6267e2feea9a0f002e..6747b8bafe10dad73fffbc9247bb0238b54cbeab 100644 (file)
@@ -101,13 +101,16 @@ static void receive_chars(struct uart_sunsab_port *up,
                          union sab82532_irq_status *stat,
                          struct pt_regs *regs)
 {
-       struct tty_struct *tty = up->port.info->tty;
+       struct tty_struct *tty = NULL;
        unsigned char buf[32];
        int saw_console_brk = 0;
        int free_fifo = 0;
        int count = 0;
        int i;
 
+       if (up->port.info != NULL)              /* Unopened serial console */
+               tty = up->port.info->tty;
+
        /* Read number of BYTES (Character + Status) available. */
        if (stat->sreg.isr0 & SAB82532_ISR0_RPF) {
                count = SAB82532_RECV_FIFO_SIZE;
@@ -142,6 +145,11 @@ static void receive_chars(struct uart_sunsab_port *up,
        for (i = 0; i < count; i++) {
                unsigned char ch = buf[i];
 
+               if (tty == NULL) {
+                       uart_handle_sysrq_char(&up->port, ch, regs);
+                       continue;
+               }
+
                if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) {
                        tty->flip.work.func((void *)tty);
                        if (tty->flip.count >= TTY_FLIPBUF_SIZE)
@@ -217,7 +225,8 @@ static void receive_chars(struct uart_sunsab_port *up,
                }
        }
 
-       tty_flip_buffer_push(tty);
+       if (tty)
+               tty_flip_buffer_push(tty);
 
        if (saw_console_brk)
                sun_do_break();