diff options
author | Huang Shijie <b32955@freescale.com> | 2014-06-11 14:55:53 +0800 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2015-01-15 21:17:09 -0600 |
commit | 52bcbc7d5274e0df2213cfc238413900663803d2 (patch) | |
tree | 305a125b04dc33467a6665b2f2842d16b7d0c053 | |
parent | 167d1ac65b3cf259da11595ec8eabb44cd302345 (diff) |
ENGR00330746 serial: imx: change the wait even to interruptiable
The wait_event() makes the application hang for ever in the following case:
[1] the hardware flow control is enabled.
[2] the other end (or the remote end) is terminated, and the TX is still
waiting for the hardware flow control signal to become asserted.
This patch fixes it by changing the wait_event to wait_event_interruptible.
(cherry picked from commit 20300f6396635224959453809b49f84f24c73094)
Signed-off-by: Huang Shijie <b32955@freescale.com>
-rw-r--r-- | drivers/tty/serial/imx.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 7a33b1d53015..2570a32bec19 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1225,9 +1225,18 @@ static void imx_shutdown(struct uart_port *port) unsigned long flags; if (sport->dma_is_enabled) { + int ret; + /* We have to wait for the DMA to finish. */ - wait_event(sport->dma_wait, + ret = wait_event_interruptible(sport->dma_wait, !sport->dma_is_rxing && !sport->dma_is_txing); + if (ret != 0) { + sport->dma_is_rxing = 0; + sport->dma_is_txing = 0; + dmaengine_terminate_all(sport->dma_chan_tx); + dmaengine_terminate_all(sport->dma_chan_rx); + } + imx_stop_tx(port); imx_stop_rx(port); imx_disable_dma(sport); imx_uart_dma_exit(sport); |