Searched hist:"409 ffc4d" (Results 1 – 1 of 1) sorted by relevance
/openbmc/linux/drivers/dma/ |
H A D | stm32-dma.c | 409ffc4d Wed Jan 29 09:36:27 CST 2020 Amelie Delaunay <amelie.delaunay@st.com> dmaengine: stm32-dma: fix sleeping function called from invalid context
This patch fixes BUG: sleeping function called from invalid context in stm32_dma_disable_chan function.
The goal of this function is to force channel disable if it has not been disabled by hardware. This consists in clearing STM32_DMA_SCR_EN bit and read it as 0 to ensure the channel is well disabled and the last transfer is over.
In previous implementation, the waiting loop was based on a do...while (1) with a call to cond_resched to give the scheduler a chance to run a higher priority process.
But in some conditions, stm32_dma_disable_chan can be called while preemption is disabled, on a stm32_dma_stop call for example. So cond_resched must not be used.
To avoid this, use readl_relaxed_poll_timeout_atomic to poll STM32_DMA_SCR_EN bit cleared.
Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200129153628.29329-8-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org> 409ffc4d Wed Jan 29 09:36:27 CST 2020 Amelie Delaunay <amelie.delaunay@st.com> dmaengine: stm32-dma: fix sleeping function called from invalid context This patch fixes BUG: sleeping function called from invalid context in stm32_dma_disable_chan function. The goal of this function is to force channel disable if it has not been disabled by hardware. This consists in clearing STM32_DMA_SCR_EN bit and read it as 0 to ensure the channel is well disabled and the last transfer is over. In previous implementation, the waiting loop was based on a do...while (1) with a call to cond_resched to give the scheduler a chance to run a higher priority process. But in some conditions, stm32_dma_disable_chan can be called while preemption is disabled, on a stm32_dma_stop call for example. So cond_resched must not be used. To avoid this, use readl_relaxed_poll_timeout_atomic to poll STM32_DMA_SCR_EN bit cleared. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200129153628.29329-8-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
|