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>
This commit is contained in:
Geert Uytterhoeven 2015-08-21 20:02:52 +02:00 committed by Greg Kroah-Hartman
parent 0533502d25
commit 47b0e94a67

View file

@ -1306,22 +1306,18 @@ static int sci_dma_rx_push(struct sci_port *s, struct scatterlist *sg,
{ {
struct uart_port *port = &s->port; struct uart_port *port = &s->port;
struct tty_port *tport = &port->state->port; struct tty_port *tport = &port->state->port;
int i, room; int copied;
room = tty_buffer_request_room(tport, count); copied = tty_insert_flip_string(tport, sg_virt(sg), count);
if (copied < count) {
if (room < count)
dev_warn(port->dev, "Rx overrun: dropping %zu bytes\n", dev_warn(port->dev, "Rx overrun: dropping %zu bytes\n",
count - room); count - copied);
if (!room) port->icount.buf_overrun++;
return room; }
for (i = 0; i < room; i++) port->icount.rx += copied;
tty_insert_flip_char(tport, ((u8 *)sg_virt(sg))[i], TTY_NORMAL);
port->icount.rx += room; return copied;
return room;
} }
static int sci_dma_rx_find_active(struct sci_port *s) static int sci_dma_rx_find_active(struct sci_port *s)