Skip to content

Commit 56abc64

Browse files
author
Radu Pirea
committed
spi: atmel: fixed spin_lock usage inside atmel_spi_remove
The only part of atmel_spi_remove which needs to be atomic is hardware reset. atmel_spi_stop_dma calls dma_terminate_all and this needs interrupts enabled. atmel_spi_release_dma calls dma_release_channel and dma_release_channel locks a mutex inside of spin_lock. So the call of these functions can't be inside a spin_lock. Reported-by: Jia-Ju Bai <baijiaju1990@gmail.com> Signed-off-by: Radu Pirea <radu.pirea@microchip.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 2958308 commit 56abc64

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/spi/spi-atmel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1654,12 +1654,12 @@ static int atmel_spi_remove(struct platform_device *pdev)
16541654
pm_runtime_get_sync(&pdev->dev);
16551655

16561656
/* reset the hardware and block queue progress */
1657-
spin_lock_irq(&as->lock);
16581657
if (as->use_dma) {
16591658
atmel_spi_stop_dma(master);
16601659
atmel_spi_release_dma(master);
16611660
}
16621661

1662+
spin_lock_irq(&as->lock);
16631663
spi_writel(as, CR, SPI_BIT(SWRST));
16641664
spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
16651665
spi_readl(as, SR);

0 commit comments

Comments
 (0)