From 89a5508e982afdd6e5eca6b5609245363ed42982 Mon Sep 17 00:00:00 2001 From: Ben Collins Date: Wed, 28 Jan 2004 01:12:06 -0500 Subject: [PATCH] [SUNSAB]: Fixup sunsab_receive_chars for when serial console isn't open (no tty) --- drivers/serial/sunsab.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index afb27a2b50f3b..6747b8bafe10d 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c @@ -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(); -- 2.53.0