From: Huang Shijie Date: Fri, 19 Sep 2014 07:42:57 +0000 (+0800) Subject: serial: imx: change the wait even to interruptiable X-Git-Tag: v3.18-rc1~129^2~11 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a4688bcd34bd2f4fe7fb88856c85d3091270ab53;p=karo-tx-linux.git 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. Signed-off-by: Huang Shijie Signed-off-by: Fugang Duan Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index db749f768ac4..8f62a3cec23e 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1219,9 +1219,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);