stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: imx-sdma: only restart cyclic channel when enabled
@ 2022-06-17 11:50 Sascha Hauer
  2022-07-01 16:38 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2022-06-17 11:50 UTC (permalink / raw)
  To: dmaengine
  Cc: Vinod Koul, Pengutronix Kernel Team, NXP Linux Team,
	Sascha Hauer, stable

An interrupt for a channel might be pending even after struct
dma_device::device_terminate_all has been called. In that case the
recently introduced warning message "restart cyclic channel..." triggers
and the channel will be restarted. This is not desired as the channel
has just been stopped. Only restart the channel when we still have a
descriptor set for it (which will be set to NULL in
sdma_terminate_all()).

Fixes: 5b215c28b9235 ("dmaengine: imx-sdma: restart cyclic channel if needed")
Cc: stable@vger.kernel.org
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/dma/imx-sdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 8535018ee7a2e..5356cce41bffc 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -891,7 +891,7 @@ static void sdma_update_channel_loop(struct sdma_channel *sdmac)
 	 * SDMA stops cyclic channel when DMA request triggers a channel and no SDMA
 	 * owned buffer is available (i.e. BD_DONE was set too late).
 	 */
-	if (!is_sdma_channel_enabled(sdmac->sdma, sdmac->channel)) {
+	if (sdmac->desc && !is_sdma_channel_enabled(sdmac->sdma, sdmac->channel)) {
 		dev_warn(sdmac->sdma->dev, "restart cyclic channel %d\n", sdmac->channel);
 		sdma_enable_channel(sdmac->sdma, sdmac->channel);
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dmaengine: imx-sdma: only restart cyclic channel when enabled
  2022-06-17 11:50 [PATCH] dmaengine: imx-sdma: only restart cyclic channel when enabled Sascha Hauer
@ 2022-07-01 16:38 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2022-07-01 16:38 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: dmaengine, Pengutronix Kernel Team, NXP Linux Team, stable

On 17-06-22, 13:50, Sascha Hauer wrote:
> An interrupt for a channel might be pending even after struct
> dma_device::device_terminate_all has been called. In that case the
> recently introduced warning message "restart cyclic channel..." triggers
> and the channel will be restarted. This is not desired as the channel
> has just been stopped. Only restart the channel when we still have a
> descriptor set for it (which will be set to NULL in
> sdma_terminate_all()).

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-01 16:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17 11:50 [PATCH] dmaengine: imx-sdma: only restart cyclic channel when enabled Sascha Hauer
2022-07-01 16:38 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).