Skip to content

Commit 854d2f2

Browse files
andy-shevbroonie
authored andcommitted
spi: dw-mid: clear BUSY flag fist and test other one
The logic of DMA completion is broken now since test_and_clear_bit() never returns the other bit is set. It means condition are always false and we have spi_finalize_current_transfer() called per each DMA completion which is wrong. The patch fixes logic by clearing BUSY bit first and then check for the other one. Fixes: 30c8eb5 (spi: dw-mid: split rx and tx callbacks when DMA) Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
1 parent c9dafb2 commit 854d2f2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/spi/spi-dw-mid.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ static void dw_spi_dma_tx_done(void *arg)
108108
{
109109
struct dw_spi *dws = arg;
110110

111-
if (test_and_clear_bit(TX_BUSY, &dws->dma_chan_busy) & BIT(RX_BUSY))
111+
clear_bit(TX_BUSY, &dws->dma_chan_busy);
112+
if (test_bit(RX_BUSY, &dws->dma_chan_busy))
112113
return;
113114
dw_spi_xfer_done(dws);
114115
}
@@ -156,7 +157,8 @@ static void dw_spi_dma_rx_done(void *arg)
156157
{
157158
struct dw_spi *dws = arg;
158159

159-
if (test_and_clear_bit(RX_BUSY, &dws->dma_chan_busy) & BIT(TX_BUSY))
160+
clear_bit(RX_BUSY, &dws->dma_chan_busy);
161+
if (test_bit(TX_BUSY, &dws->dma_chan_busy))
160162
return;
161163
dw_spi_xfer_done(dws);
162164
}

0 commit comments

Comments
 (0)