aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/m32r_sio.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2014-07-06 11:29:52 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-10 16:31:34 -0700
commitc557d392fbf5badd693ea1946a4317c87a26a716 (patch)
tree10b1369df578934fa8d43fbef7c69fb523ac5ab9 /drivers/tty/serial/m32r_sio.c
parentLinux 3.16-rc4 (diff)
downloadlinux-dev-c557d392fbf5badd693ea1946a4317c87a26a716.tar.xz
linux-dev-c557d392fbf5badd693ea1946a4317c87a26a716.zip
serial: Test for no tx data on tx restart
Commit 717f3bbab3c7628736ef738fdbf3d9a28578c26c, 'serial_core: Fix conditional start_tx on ring buffer not empty' exposes an incorrect assumption in several drivers' start_tx methods; the tx ring buffer can, in fact, be empty when restarting tx while performing flow control. Affected drivers: sunsab.c ip22zilog.c pmac_zilog.c sunzilog.c m32r_sio.c imx.c Other in-tree serial drivers either are not affected or already test for empty tx ring buffer before transmitting. Test for empty tx ring buffer in start_tx() method, after transmitting x_char (if applicable). Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi> Cc: Seth Bollinger <sethb@digi.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Cc: stable <stable@vger.kernel.org> # 3.15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/m32r_sio.c')
-rw-r--r--drivers/tty/serial/m32r_sio.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/tty/serial/m32r_sio.c b/drivers/tty/serial/m32r_sio.c
index 68f2c53e0b54..5702828fb62e 100644
--- a/drivers/tty/serial/m32r_sio.c
+++ b/drivers/tty/serial/m32r_sio.c
@@ -266,9 +266,11 @@ static void m32r_sio_start_tx(struct uart_port *port)
if (!(up->ier & UART_IER_THRI)) {
up->ier |= UART_IER_THRI;
serial_out(up, UART_IER, up->ier);
- serial_out(up, UART_TX, xmit->buf[xmit->tail]);
- xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
- up->port.icount.tx++;
+ if (!uart_circ_empty(xmit)) {
+ serial_out(up, UART_TX, xmit->buf[xmit->tail]);
+ xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
+ up->port.icount.tx++;
+ }
}
while((serial_in(up, UART_LSR) & UART_EMPTY) != UART_EMPTY);
#else