aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mn10300/kernel/mn10300-serial.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c
index 339cef4c8256..131b81f9d6c8 100644
--- a/arch/mn10300/kernel/mn10300-serial.c
+++ b/arch/mn10300/kernel/mn10300-serial.c
@@ -487,16 +487,17 @@ static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port)
487 487
488try_again: 488try_again:
489 /* pull chars out of the hat */ 489 /* pull chars out of the hat */
490 ix = port->rx_outp; 490 ix = ACCESS_ONCE(port->rx_outp);
491 if (ix == port->rx_inp) { 491 if (CIRC_CNT(port->rx_inp, ix, MNSC_BUFFER_SIZE) == 0) {
492 if (push && !tty->low_latency) 492 if (push && !tty->low_latency)
493 tty_flip_buffer_push(tty); 493 tty_flip_buffer_push(tty);
494 return; 494 return;
495 } 495 }
496 496
497 smp_read_barrier_depends();
497 ch = port->rx_buffer[ix++]; 498 ch = port->rx_buffer[ix++];
498 st = port->rx_buffer[ix++]; 499 st = port->rx_buffer[ix++];
499 smp_rmb(); 500 smp_mb();
500 port->rx_outp = ix & (MNSC_BUFFER_SIZE - 1); 501 port->rx_outp = ix & (MNSC_BUFFER_SIZE - 1);
501 port->uart.icount.rx++; 502 port->uart.icount.rx++;
502 503
@@ -1657,13 +1658,14 @@ static int mn10300_serial_poll_get_char(struct uart_port *_port)
1657 1658
1658 do { 1659 do {
1659 /* pull chars out of the hat */ 1660 /* pull chars out of the hat */
1660 ix = port->rx_outp; 1661 ix = ACCESS_ONCE(port->rx_outp);
1661 if (ix == port->rx_inp) 1662 if (CIRC_CNT(port->rx_inp, ix, MNSC_BUFFER_SIZE) == 0)
1662 return NO_POLL_CHAR; 1663 return NO_POLL_CHAR;
1663 1664
1665 smp_read_barrier_depends();
1664 ch = port->rx_buffer[ix++]; 1666 ch = port->rx_buffer[ix++];
1665 st = port->rx_buffer[ix++]; 1667 st = port->rx_buffer[ix++];
1666 smp_rmb(); 1668 smp_mb();
1667 port->rx_outp = ix & (MNSC_BUFFER_SIZE - 1); 1669 port->rx_outp = ix & (MNSC_BUFFER_SIZE - 1);
1668 1670
1669 } while (st & (SC01STR_FEF | SC01STR_PEF | SC01STR_OEF)); 1671 } while (st & (SC01STR_FEF | SC01STR_PEF | SC01STR_OEF));