Browse Source

serial: imx: count tty buffer overruns

As can be seen in function uart_insert_char (serial_core) the element
buf_overrun of struct uart_icount is used to count overruns of
tty-buffer.
Added support for counting of overruns in imx driver analogue to
serial_core.

Signed-off-by: Manfred Schlaegl <manfred.schlaegl@gmx.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Manfred Schlaegl 10 năm trước cách đây
mục cha
commit
9b28993261
1 tập tin đã thay đổi với 9 bổ sung3 xóa
  1. 9 3
      drivers/tty/serial/imx.c

+ 9 - 3
drivers/tty/serial/imx.c

@@ -700,7 +700,8 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
 		if (sport->port.ignore_status_mask & URXD_DUMMY_READ)
 		if (sport->port.ignore_status_mask & URXD_DUMMY_READ)
 			goto out;
 			goto out;
 
 
-		tty_insert_flip_char(port, rx, flg);
+		if (tty_insert_flip_char(port, rx, flg) == 0)
+			sport->port.icount.buf_overrun++;
 	}
 	}
 
 
 out:
 out:
@@ -921,8 +922,13 @@ static void dma_rx_callback(void *data)
 	dev_dbg(sport->port.dev, "We get %d bytes.\n", count);
 	dev_dbg(sport->port.dev, "We get %d bytes.\n", count);
 
 
 	if (count) {
 	if (count) {
-		if (!(sport->port.ignore_status_mask & URXD_DUMMY_READ))
-			tty_insert_flip_string(port, sport->rx_buf, count);
+		if (!(sport->port.ignore_status_mask & URXD_DUMMY_READ)) {
+			int bytes = tty_insert_flip_string(port, sport->rx_buf,
+					count);
+
+			if (bytes != count)
+				sport->port.icount.buf_overrun++;
+		}
 		tty_flip_buffer_push(port);
 		tty_flip_buffer_push(port);
 
 
 		start_rx_dma(sport);
 		start_rx_dma(sport);