• Geert Uytterhoeven's avatar
    spi: rspi: Fix interrupted DMA transfers · 8dbbaa47
    Geert Uytterhoeven authored
    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: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    Cc: stable@vger.kernel.org
    8dbbaa47
spi-rspi.c 35.6 KB