summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/sh-sci.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2015-08-21 18:02:52 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-04 16:33:48 (GMT)
commit47b0e94a67d4ab771a05dd23a2c5cc5c2c533fdc (patch)
tree5da0d815c8934ff7ee62289190baa32dc1be1a4d /drivers/tty/serial/sh-sci.c
parent0533502d258371cab9eb1a51eaf2ec5d5c11f9bb (diff)
downloadlinux-47b0e94a67d4ab771a05dd23a2c5cc5c2c533fdc.tar.xz
serial: sh-sci: Use tty_insert_flip_string() for DMA receive
Switch from using tty_buffer_request_room() and looping over tty_insert_flip_char() to tty_insert_flip_string(). Keep track of buffer overruns in the icount structure, like serial_core.c does. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/sh-sci.c')
-rw-r--r--drivers/tty/serial/sh-sci.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 2b44004..57b1cc1 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1306,22 +1306,18 @@ static int sci_dma_rx_push(struct sci_port *s, struct scatterlist *sg,
{
struct uart_port *port = &s->port;
struct tty_port *tport = &port->state->port;
- int i, room;
+ int copied;
- room = tty_buffer_request_room(tport, count);
-
- if (room < count)
+ copied = tty_insert_flip_string(tport, sg_virt(sg), count);
+ if (copied < count) {
dev_warn(port->dev, "Rx overrun: dropping %zu bytes\n",
- count - room);
- if (!room)
- return room;
-
- for (i = 0; i < room; i++)
- tty_insert_flip_char(tport, ((u8 *)sg_virt(sg))[i], TTY_NORMAL);
+ count - copied);
+ port->icount.buf_overrun++;
+ }
- port->icount.rx += room;
+ port->icount.rx += copied;
- return room;
+ return copied;
}
static int sci_dma_rx_find_active(struct sci_port *s)