diff options
author | Qipan Li <Qipan.Li@csr.com> | 2015-05-14 06:45:23 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-05-24 12:50:41 -0700 |
commit | 36c0991089ef190ee5e3f72e1346c623b24a0e7d (patch) | |
tree | e7c0e097d16ac2bd72186c9dc5e1566ef6929f78 /drivers/tty/serial | |
parent | eab192ae56fd52416af485e3d7ba2c6982200d71 (diff) |
serial: sirf: fix endless loop bug in uart receive tasklet
In special condition, when cpu schedule into rx_tmo_process_tl or
rx_dma_complete_tl and all the receive dma tasks have done, it will
go into endless loop because no dma task cookie status be changed.
Signed-off-by: Qipan Li <Qipan.Li@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r-- | drivers/tty/serial/sirfsoc_uart.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c index 48cceaf5338a..ffeb7663bd6e 100644 --- a/drivers/tty/serial/sirfsoc_uart.c +++ b/drivers/tty/serial/sirfsoc_uart.c @@ -488,6 +488,7 @@ static void sirfsoc_rx_tmo_process_tl(unsigned long param) unsigned int count; struct dma_tx_state tx_state; unsigned long flags; + int i = 0; spin_lock_irqsave(&port->lock, flags); while (DMA_COMPLETE == dmaengine_tx_status(sirfport->rx_dma_chan, @@ -497,6 +498,9 @@ static void sirfsoc_rx_tmo_process_tl(unsigned long param) SIRFSOC_RX_DMA_BUF_SIZE); sirfport->rx_completed++; sirfport->rx_completed %= SIRFSOC_RX_LOOP_BUF_CNT; + i++; + if (i > SIRFSOC_RX_LOOP_BUF_CNT) + break; } count = CIRC_CNT(sirfport->rx_dma_items[sirfport->rx_issued].xmit.head, sirfport->rx_dma_items[sirfport->rx_issued].xmit.tail, @@ -713,6 +717,8 @@ static void sirfsoc_uart_rx_dma_complete_tl(unsigned long param) struct sirfsoc_int_en *uint_en = &sirfport->uart_reg->uart_int_en; struct dma_tx_state tx_state; unsigned long flags; + int i = 0; + spin_lock_irqsave(&port->lock, flags); while (DMA_COMPLETE == dmaengine_tx_status(sirfport->rx_dma_chan, sirfport->rx_dma_items[sirfport->rx_completed].cookie, @@ -726,6 +732,9 @@ static void sirfsoc_uart_rx_dma_complete_tl(unsigned long param) else sirfport->rx_completed++; sirfport->rx_completed %= SIRFSOC_RX_LOOP_BUF_CNT; + i++; + if (i > SIRFSOC_RX_LOOP_BUF_CNT) + break; } spin_unlock_irqrestore(&port->lock, flags); tty_flip_buffer_push(&port->state->port); |