Skip to content

Commit

Permalink
serial: imx: change the wait even to interruptiable
Browse files Browse the repository at this point in the history
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 <shijie8@gmail.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Huang Shijie authored and Greg Kroah-Hartman committed Sep 29, 2014
1 parent 45564a6 commit a4688bc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion drivers/tty/serial/imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a4688bc

Please sign in to comment.