tty: serial: extract serial_omap_put_char() from transmit_chars()
JIRA: https://issues.redhat.com/browse/RHEL-24205 commit 7ef26ab6feea3459d96dff9e4f98bf8a20bfb809 Author: Jiri Slaby <jirislaby@kernel.org> Date: Tue Sep 20 07:20:47 2022 +0200 tty: serial: extract serial_omap_put_char() from transmit_chars() This non-trivial code is doubled in transmit_chars(), so it deserves its own function. This will make next patches easier. Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20220920052049.20507-8-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
This commit is contained in:
parent
a9444c95d8
commit
557a0fe1be
|
@ -331,19 +331,24 @@ static void serial_omap_stop_rx(struct uart_port *port)
|
||||||
serial_out(up, UART_IER, up->ier);
|
serial_out(up, UART_IER, up->ier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void serial_omap_put_char(struct uart_omap_port *up, unsigned char ch)
|
||||||
|
{
|
||||||
|
serial_out(up, UART_TX, ch);
|
||||||
|
|
||||||
|
if ((up->port.rs485.flags & SER_RS485_ENABLED) &&
|
||||||
|
!(up->port.rs485.flags & SER_RS485_RX_DURING_TX))
|
||||||
|
up->rs485_tx_filter_count++;
|
||||||
|
}
|
||||||
|
|
||||||
static void transmit_chars(struct uart_omap_port *up, unsigned int lsr)
|
static void transmit_chars(struct uart_omap_port *up, unsigned int lsr)
|
||||||
{
|
{
|
||||||
struct circ_buf *xmit = &up->port.state->xmit;
|
struct circ_buf *xmit = &up->port.state->xmit;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
if (up->port.x_char) {
|
if (up->port.x_char) {
|
||||||
serial_out(up, UART_TX, up->port.x_char);
|
serial_omap_put_char(up, up->port.x_char);
|
||||||
up->port.icount.tx++;
|
up->port.icount.tx++;
|
||||||
up->port.x_char = 0;
|
up->port.x_char = 0;
|
||||||
if ((up->port.rs485.flags & SER_RS485_ENABLED) &&
|
|
||||||
!(up->port.rs485.flags & SER_RS485_RX_DURING_TX))
|
|
||||||
up->rs485_tx_filter_count++;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) {
|
if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) {
|
||||||
|
@ -352,12 +357,9 @@ static void transmit_chars(struct uart_omap_port *up, unsigned int lsr)
|
||||||
}
|
}
|
||||||
count = up->port.fifosize / 4;
|
count = up->port.fifosize / 4;
|
||||||
do {
|
do {
|
||||||
serial_out(up, UART_TX, xmit->buf[xmit->tail]);
|
serial_omap_put_char(up, xmit->buf[xmit->tail]);
|
||||||
xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
|
xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
|
||||||
up->port.icount.tx++;
|
up->port.icount.tx++;
|
||||||
if ((up->port.rs485.flags & SER_RS485_ENABLED) &&
|
|
||||||
!(up->port.rs485.flags & SER_RS485_RX_DURING_TX))
|
|
||||||
up->rs485_tx_filter_count++;
|
|
||||||
|
|
||||||
if (uart_circ_empty(xmit))
|
if (uart_circ_empty(xmit))
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue