Skip to content

Commit

Permalink
Revert "serial: imx: always wake up the processes in the TX callback"
Browse files Browse the repository at this point in the history
This reverts commit 2ad28e3.

Instead of always wake up write_wait process in TX callback,
TX callback should call imx_dma_tx() again, and let imx_dma_tx
transfer the remaining data in circle buffer.

The issue with commit 2ad28e3 is, in case there is remaining
data in circle buffer, but no process is waiting on write_wait
queue, then as no following uart_write() will be called after
uart_write_wakeup(), thus cause data loss.

Moreover according to Documentation/serial/driver, uart_write_wakeup()
should be called in case the transmit buffer have dropped below
a threshold.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jiada Wang authored and Greg Kroah-Hartman committed Jan 9, 2015
1 parent 42f752b commit d64b860
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/tty/serial/imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,8 @@ static void dma_tx_callback(void *data)

spin_unlock_irqrestore(&sport->port.lock, flags);

uart_write_wakeup(&sport->port);
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
uart_write_wakeup(&sport->port);

if (waitqueue_active(&sport->dma_wait)) {
wake_up(&sport->dma_wait);
Expand Down

0 comments on commit d64b860

Please sign in to comment.