Commit 89a5508e authored by Ben Collins's avatar Ben Collins Committed by Ben Collins

[SUNSAB]: Fixup sunsab_receive_chars for when serial console isn't open (no tty)

parent 4b887d8a
...@@ -101,13 +101,16 @@ static void receive_chars(struct uart_sunsab_port *up, ...@@ -101,13 +101,16 @@ static void receive_chars(struct uart_sunsab_port *up,
union sab82532_irq_status *stat, union sab82532_irq_status *stat,
struct pt_regs *regs) struct pt_regs *regs)
{ {
struct tty_struct *tty = up->port.info->tty; struct tty_struct *tty = NULL;
unsigned char buf[32]; unsigned char buf[32];
int saw_console_brk = 0; int saw_console_brk = 0;
int free_fifo = 0; int free_fifo = 0;
int count = 0; int count = 0;
int i; int i;
if (up->port.info != NULL) /* Unopened serial console */
tty = up->port.info->tty;
/* Read number of BYTES (Character + Status) available. */ /* Read number of BYTES (Character + Status) available. */
if (stat->sreg.isr0 & SAB82532_ISR0_RPF) { if (stat->sreg.isr0 & SAB82532_ISR0_RPF) {
count = SAB82532_RECV_FIFO_SIZE; count = SAB82532_RECV_FIFO_SIZE;
...@@ -142,6 +145,11 @@ static void receive_chars(struct uart_sunsab_port *up, ...@@ -142,6 +145,11 @@ static void receive_chars(struct uart_sunsab_port *up,
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
unsigned char ch = buf[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)) { if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) {
tty->flip.work.func((void *)tty); tty->flip.work.func((void *)tty);
if (tty->flip.count >= TTY_FLIPBUF_SIZE) if (tty->flip.count >= TTY_FLIPBUF_SIZE)
...@@ -217,7 +225,8 @@ static void receive_chars(struct uart_sunsab_port *up, ...@@ -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) if (saw_console_brk)
sun_do_break(); sun_do_break();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment