aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sunsu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/sunsu.c')
-rw-r--r--drivers/serial/sunsu.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index f0738533f39a..9a3665b34d97 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -323,19 +323,13 @@ static _INLINE_ struct tty_struct *
323receive_chars(struct uart_sunsu_port *up, unsigned char *status, struct pt_regs *regs) 323receive_chars(struct uart_sunsu_port *up, unsigned char *status, struct pt_regs *regs)
324{ 324{
325 struct tty_struct *tty = up->port.info->tty; 325 struct tty_struct *tty = up->port.info->tty;
326 unsigned char ch; 326 unsigned char ch, flag;
327 int max_count = 256; 327 int max_count = 256;
328 int saw_console_brk = 0; 328 int saw_console_brk = 0;
329 329
330 do { 330 do {
331 if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) {
332 tty->flip.work.func((void *)tty);
333 if (tty->flip.count >= TTY_FLIPBUF_SIZE)
334 return tty; // if TTY_DONT_FLIP is set
335 }
336 ch = serial_inp(up, UART_RX); 331 ch = serial_inp(up, UART_RX);
337 *tty->flip.char_buf_ptr = ch; 332 flag = TTY_NORMAL;
338 *tty->flip.flag_buf_ptr = TTY_NORMAL;
339 up->port.icount.rx++; 333 up->port.icount.rx++;
340 334
341 if (unlikely(*status & (UART_LSR_BI | UART_LSR_PE | 335 if (unlikely(*status & (UART_LSR_BI | UART_LSR_PE |
@@ -377,31 +371,23 @@ receive_chars(struct uart_sunsu_port *up, unsigned char *status, struct pt_regs
377 } 371 }
378 372
379 if (*status & UART_LSR_BI) { 373 if (*status & UART_LSR_BI) {
380 *tty->flip.flag_buf_ptr = TTY_BREAK; 374 flag = TTY_BREAK;
381 } else if (*status & UART_LSR_PE) 375 } else if (*status & UART_LSR_PE)
382 *tty->flip.flag_buf_ptr = TTY_PARITY; 376 flag = TTY_PARITY;
383 else if (*status & UART_LSR_FE) 377 else if (*status & UART_LSR_FE)
384 *tty->flip.flag_buf_ptr = TTY_FRAME; 378 flag = TTY_FRAME;
385 } 379 }
386 if (uart_handle_sysrq_char(&up->port, ch, regs)) 380 if (uart_handle_sysrq_char(&up->port, ch, regs))
387 goto ignore_char; 381 goto ignore_char;
388 if ((*status & up->port.ignore_status_mask) == 0) { 382 if ((*status & up->port.ignore_status_mask) == 0)
389 tty->flip.flag_buf_ptr++; 383 tty_insert_flip_char(tty, ch, flag);
390 tty->flip.char_buf_ptr++; 384 if (*status & UART_LSR_OE)
391 tty->flip.count++;
392 }
393 if ((*status & UART_LSR_OE) &&
394 tty->flip.count < TTY_FLIPBUF_SIZE) {
395 /* 385 /*
396 * Overrun is special, since it's reported 386 * Overrun is special, since it's reported
397 * immediately, and doesn't affect the current 387 * immediately, and doesn't affect the current
398 * character. 388 * character.
399 */ 389 */
400 *tty->flip.flag_buf_ptr = TTY_OVERRUN; 390 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
401 tty->flip.flag_buf_ptr++;
402 tty->flip.char_buf_ptr++;
403 tty->flip.count++;
404 }
405 ignore_char: 391 ignore_char:
406 *status = serial_inp(up, UART_LSR); 392 *status = serial_inp(up, UART_LSR);
407 } while ((*status & UART_LSR_DR) && (max_count-- > 0)); 393 } while ((*status & UART_LSR_DR) && (max_count-- > 0));