summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/bfin_uart.c
diff options
context:
space:
mode:
authorSteven Miao <realmz6@gmail.com>2012-11-07 09:27:56 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-11-16 04:59:58 +0400
commit9642dbe73c8a3b55a812253fcb9add9eeed4ca81 (patch)
treebdd51cf2a84b33b7c672d738b5a1eaf12bab342d /drivers/tty/serial/bfin_uart.c
parent7a876b39b5bc94f67e8a3a7adfd270b8c21fc762 (diff)
downloadlinux-9642dbe73c8a3b55a812253fcb9add9eeed4ca81.tar.xz
serial: bfin-uart: avoid dead lock in rx irq handler in smp kernel
Disabing dma irq and lock bottom half in smp kernel doesn't ensure exclusive uart access. Call spin_lock_irqsave() instead. Signed-off-by: Steven Miao <realmz6@gmail.com> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/bfin_uart.c')
-rw-r--r--drivers/tty/serial/bfin_uart.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c
index 9242d56ba267..ca64c4a83ce0 100644
--- a/drivers/tty/serial/bfin_uart.c
+++ b/drivers/tty/serial/bfin_uart.c
@@ -477,9 +477,9 @@ static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
{
int x_pos, pos;
+ unsigned long flags;
- dma_disable_irq_nosync(uart->rx_dma_channel);
- spin_lock_bh(&uart->rx_lock);
+ spin_lock_irqsave(&uart->rx_lock, flags);
/* 2D DMA RX buffer ring is used. Because curr_y_count and
* curr_x_count can't be read as an atomic operation,
@@ -510,8 +510,7 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
uart->rx_dma_buf.tail = uart->rx_dma_buf.head;
}
- spin_unlock_bh(&uart->rx_lock);
- dma_enable_irq(uart->rx_dma_channel);
+ spin_unlock_irqrestore(&uart->rx_lock, flags);
mod_timer(&(uart->rx_dma_timer), jiffies + DMA_RX_FLUSH_JIFFIES);
}