diff options
author | Jiri Slaby <jslaby@suse.cz> | 2013-01-03 18:53:03 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-16 10:21:36 +0400 |
commit | 92a19f9cec9a80ad93c06e115822deb729e2c6ad (patch) | |
tree | 80e1550ac1647a1cdf20a0b568554c0c50a63f75 /drivers/tty/serial/sh-sci.c | |
parent | 2f69335710884ae6112fc8196ebe29b5cda7b79b (diff) | |
download | linux-92a19f9cec9a80ad93c06e115822deb729e2c6ad.tar.xz |
TTY: switch tty_insert_flip_char
Now, we start converting tty buffer functions to actually use
tty_port. This will allow us to get rid of the need of tty in many
call sites. Only tty_port will needed and hence no more
tty_port_tty_get in those paths.
tty_insert_flip_char is the next one to proceed. This one is used all
over the code, so the patch is huge.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
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.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index cf96314770fb..ecef748f5385 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -620,7 +620,7 @@ static void sci_receive_chars(struct uart_port *port) sci_port->break_flag) count = 0; else - tty_insert_flip_char(tty, c, TTY_NORMAL); + tty_insert_flip_char(tport, c, TTY_NORMAL); } else { for (i = 0; i < count; i++) { char c = serial_port_in(port, SCxRDR); @@ -662,7 +662,7 @@ static void sci_receive_chars(struct uart_port *port) } else flag = TTY_NORMAL; - tty_insert_flip_char(tty, c, flag); + tty_insert_flip_char(tport, c, flag); } } @@ -721,7 +721,8 @@ static int sci_handle_errors(struct uart_port *port) { int copied = 0; unsigned short status = serial_port_in(port, SCxSR); - struct tty_struct *tty = port->state->port.tty; + struct tty_port *tport = &port->state->port; + struct tty_struct *tty = tport->tty; struct sci_port *s = to_sci_port(port); /* @@ -732,7 +733,7 @@ static int sci_handle_errors(struct uart_port *port) port->icount.overrun++; /* overrun error */ - if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) + if (tty_insert_flip_char(tport, 0, TTY_OVERRUN)) copied++; dev_notice(port->dev, "overrun error"); @@ -756,7 +757,7 @@ static int sci_handle_errors(struct uart_port *port) dev_dbg(port->dev, "BREAK detected\n"); - if (tty_insert_flip_char(tty, 0, TTY_BREAK)) + if (tty_insert_flip_char(tport, 0, TTY_BREAK)) copied++; } @@ -764,7 +765,7 @@ static int sci_handle_errors(struct uart_port *port) /* frame error */ port->icount.frame++; - if (tty_insert_flip_char(tty, 0, TTY_FRAME)) + if (tty_insert_flip_char(tport, 0, TTY_FRAME)) copied++; dev_notice(port->dev, "frame error\n"); @@ -775,7 +776,7 @@ static int sci_handle_errors(struct uart_port *port) /* parity error */ port->icount.parity++; - if (tty_insert_flip_char(tty, 0, TTY_PARITY)) + if (tty_insert_flip_char(tport, 0, TTY_PARITY)) copied++; dev_notice(port->dev, "parity error"); @@ -789,7 +790,8 @@ static int sci_handle_errors(struct uart_port *port) static int sci_handle_fifo_overrun(struct uart_port *port) { - struct tty_struct *tty = port->state->port.tty; + struct tty_port *tport = &port->state->port; + struct tty_struct *tty = tport->tty; struct sci_port *s = to_sci_port(port); struct plat_sci_reg *reg; int copied = 0; @@ -803,7 +805,7 @@ static int sci_handle_fifo_overrun(struct uart_port *port) port->icount.overrun++; - tty_insert_flip_char(tty, 0, TTY_OVERRUN); + tty_insert_flip_char(tport, 0, TTY_OVERRUN); tty_flip_buffer_push(tty); dev_notice(port->dev, "overrun error\n"); @@ -817,7 +819,8 @@ static int sci_handle_breaks(struct uart_port *port) { int copied = 0; unsigned short status = serial_port_in(port, SCxSR); - struct tty_struct *tty = port->state->port.tty; + struct tty_port *tport = &port->state->port; + struct tty_struct *tty = tport->tty; struct sci_port *s = to_sci_port(port); if (uart_handle_break(port)) @@ -832,7 +835,7 @@ static int sci_handle_breaks(struct uart_port *port) port->icount.brk++; /* Notify of BREAK */ - if (tty_insert_flip_char(tty, 0, TTY_BREAK)) + if (tty_insert_flip_char(tport, 0, TTY_BREAK)) copied++; dev_dbg(port->dev, "BREAK detected\n"); @@ -1260,8 +1263,7 @@ static void sci_dma_tx_complete(void *arg) } /* Locking: called with port lock held */ -static int sci_dma_rx_push(struct sci_port *s, struct tty_struct *tty, - size_t count) +static int sci_dma_rx_push(struct sci_port *s, size_t count) { struct uart_port *port = &s->port; struct tty_port *tport = &port->state->port; @@ -1285,7 +1287,7 @@ static int sci_dma_rx_push(struct sci_port *s, struct tty_struct *tty, return room; for (i = 0; i < room; i++) - tty_insert_flip_char(tty, ((u8 *)sg_virt(&s->sg_rx[active]))[i], + tty_insert_flip_char(tport, ((u8 *)sg_virt(&s->sg_rx[active]))[i], TTY_NORMAL); port->icount.rx += room; @@ -1305,7 +1307,7 @@ static void sci_dma_rx_complete(void *arg) spin_lock_irqsave(&port->lock, flags); - count = sci_dma_rx_push(s, tty, s->buf_len_rx); + count = sci_dma_rx_push(s, s->buf_len_rx); mod_timer(&s->rx_timer, jiffies + s->rx_timeout); @@ -1418,7 +1420,7 @@ static void work_fn_rx(struct work_struct *work) sh_desc->partial, sh_desc->cookie); spin_lock_irqsave(&port->lock, flags); - count = sci_dma_rx_push(s, tty, sh_desc->partial); + count = sci_dma_rx_push(s, sh_desc->partial); spin_unlock_irqrestore(&port->lock, flags); if (count) |