diff options
Diffstat (limited to 'drivers/tty/serial/mux.c')
| -rw-r--r-- | drivers/tty/serial/mux.c | 45 | 
1 files changed, 13 insertions, 32 deletions
diff --git a/drivers/tty/serial/mux.c b/drivers/tty/serial/mux.c index ed0e763f622a..85ce1e9af44a 100644 --- a/drivers/tty/serial/mux.c +++ b/drivers/tty/serial/mux.c @@ -171,6 +171,13 @@ static void mux_break_ctl(struct uart_port *port, int break_state)  {  } +static void mux_tx_done(struct uart_port *port) +{ +	/* FIXME js: really needs to wait? */ +	while (UART_GET_FIFO_CNT(port)) +		udelay(1); +} +  /**   * mux_write - Write chars to the mux fifo.   * @port: Ptr to the uart_port. @@ -180,39 +187,13 @@ static void mux_break_ctl(struct uart_port *port, int break_state)   */  static void mux_write(struct uart_port *port)  { -	int count; -	struct circ_buf *xmit = &port->state->xmit; - -	if(port->x_char) { -		UART_PUT_CHAR(port, port->x_char); -		port->icount.tx++; -		port->x_char = 0; -		return; -	} - -	if(uart_circ_empty(xmit) || uart_tx_stopped(port)) { -		mux_stop_tx(port); -		return; -	} - -	count = (port->fifosize) - UART_GET_FIFO_CNT(port); -	do { -		UART_PUT_CHAR(port, xmit->buf[xmit->tail]); -		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); -		port->icount.tx++; -		if(uart_circ_empty(xmit)) -			break; - -	} while(--count > 0); - -	while(UART_GET_FIFO_CNT(port))  -		udelay(1); - -	if(uart_circ_chars_pending(xmit) < WAKEUP_CHARS) -		uart_write_wakeup(port); +	u8 ch; -	if (uart_circ_empty(xmit)) -		mux_stop_tx(port); +	uart_port_tx_limited(port, ch, +		port->fifosize - UART_GET_FIFO_CNT(port), +		true, +		UART_PUT_CHAR(port, ch), +		mux_tx_done(port));  }  /**  |