dmaengine: at_xdmac: Fix locking in tasklet
authorTudor Ambarus <tudor.ambarus@microchip.com>
Thu, 23 Jan 2020 14:03:17 +0000 (14:03 +0000)
committerVinod Koul <vkoul@kernel.org>
Tue, 25 Feb 2020 05:57:27 +0000 (11:27 +0530)
commit191bd1cad3535a30c2931dc1757e260afe03854b
tree2c5237475f045f78ac744db8ada45c9be9f46f84
parent8592f2c81ebc494017d574fd8b731be44087a2e9
dmaengine: at_xdmac: Fix locking in tasklet

Tasklets run with all the interrupts enabled. This means that we should
replace all the (already present) spin_lock_irqsave() uses in the tasklet
with spin_lock_irq() to protect being interrupted by a IRQ which tries
to get the same lock (via calls to device_prep_dma_* for example).

spin_lock and spin_lock_bh in tasklets are not enough to protect from IRQs,
update these to spin_lock_irq().

at_xdmac_advance_work() can be called with all the interrupts enabled (when
called from tasklet), or with interrupts disabled (when called from
at_xdmac_issue_pending). Move the locking in the callers to be able to use
spin_lock_irq() and spin_lock_irqsave() for these cases.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Link: https://lore.kernel.org/r/20200123140237.125799-10-tudor.ambarus@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/at_xdmac.c