]> git.baikalelectronics.ru Git - kernel.git/commit
dmaengine: stm32-dma: fix potential race between pause and resume
authorAmelie Delaunay <amelie.delaunay@foss.st.com>
Mon, 24 Oct 2022 08:36:11 +0000 (10:36 +0200)
committerVinod Koul <vkoul@kernel.org>
Tue, 8 Nov 2022 05:13:56 +0000 (10:43 +0530)
commit62aae4106ed25ef8b71e4508ac16baf1146b6bec
tree593e0d646927c5a4f89afdfc8ea00bbd176b97dc
parentffbe9f97fc247e462f7b8b7efecfc6753c3599e3
dmaengine: stm32-dma: fix potential race between pause and resume

When disabling dma channel, a TCF flag is set and as TCIE is enabled, an
interrupt is raised.
On a busy system, the interrupt may have latency and the user can ask for
dmaengine_resume while stm32-dma driver has not yet managed the complete
pause (backup of registers to restore state in resume).
To avoid such a case, instead of waiting the interrupt to backup the
registers, do it just after disabling the channel and discard Transfer
Complete interrupt in case the channel is paused.

Fixes: 85d5334a4660 ("dmaengine: stm32-dma: add device_pause/device_resume support")
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/20221024083611.132588-1-amelie.delaunay@foss.st.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/stm32-dma.c