mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 02:50:43 +00:00
spi: rspi: Fix interrupted DMA transfers
When interrupted, wait_event_interruptible_timeout() returns -ERESTARTSYS, and the SPI transfer in progress will fail, as expected: m25p80 spi0.0: SPI transfer failed: -512 spi_master spi0: failed to transfer one message from queue However, as the underlying DMA transfers may not have completed, all subsequent SPI transfers may start to fail: spi_master spi0: receive timeout qspi_transfer_out_in() returned -110 m25p80 spi0.0: SPI transfer failed: -110 spi_master spi0: failed to transfer one message from queue Fix this by calling dmaengine_terminate_all() not only for timeouts, but also for errors. This can be reproduced on r8a7991/koelsch, using "hd /dev/mtd0" followed by CTRL-C. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
This commit is contained in:
parent
c1ca59c22c
commit
8dbbaa47b9
1 changed files with 6 additions and 4 deletions
|
@ -598,11 +598,13 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx,
|
||||||
|
|
||||||
ret = wait_event_interruptible_timeout(rspi->wait,
|
ret = wait_event_interruptible_timeout(rspi->wait,
|
||||||
rspi->dma_callbacked, HZ);
|
rspi->dma_callbacked, HZ);
|
||||||
if (ret > 0 && rspi->dma_callbacked)
|
if (ret > 0 && rspi->dma_callbacked) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
else if (!ret) {
|
} else {
|
||||||
dev_err(&rspi->master->dev, "DMA timeout\n");
|
if (!ret) {
|
||||||
ret = -ETIMEDOUT;
|
dev_err(&rspi->master->dev, "DMA timeout\n");
|
||||||
|
ret = -ETIMEDOUT;
|
||||||
|
}
|
||||||
if (tx)
|
if (tx)
|
||||||
dmaengine_terminate_all(rspi->master->dma_tx);
|
dmaengine_terminate_all(rspi->master->dma_tx);
|
||||||
if (rx)
|
if (rx)
|
||||||
|
|
Loading…
Reference in a new issue