Skip to content

Commit

Permalink
serial: bfin-uart: avoid dead lock in rx irq handler in smp kernel
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
realmz authored and gregkh committed Nov 16, 2012
1 parent 7a876b3 commit 9642dbe
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/tty/serial/bfin_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 9642dbe

Please sign in to comment.