Skip to contentSkip to conversation

dmaengine: stm32-dma: drop the runtime PM reference when suspend is refused

PATCH In review Cong Nguyen 2 participants 2 messages Nov 29 – Nov 30

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: stm32-dma: drop the runtime PM reference when suspend is refused

stm32_dma_pm_suspend() returns -EBUSY when a channel is still enabled, without dropping the runtime PM reference it took, so the controller stays runtime resumed.

Call pm_runtime_put_sync() before returning -EBUSY.

Fixes 05f8740a0e6f ("dmaengine: stm32-dma: add suspend/resume power management support")
---
 drivers/dma/stm32/stm32-dma.c | 1 +
 1 file changed, 1 insertion(+)
drivers/dma/stm32/stm32-dma.c +1 -0
index ba8121d37f51..5e1bf8cdedb3 100644
@@ -1738,6 +1738,7 @@ static int stm32_dma_pm_suspend(struct device *dev)
 		scr = stm32_dma_read(dmadev, STM32_DMA_SCR(id));
 		if (scr & STM32_DMA_SCR_EN) {
 			dev_warn(dev, "Suspend is prevented by Chan %i\n", id);
+			pm_runtime_put_sync(dev);
 			return -EBUSY;
 		}
 	}
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi,

Thanks for your patch.

Quoted 8 lines · Cong Nguyen

stm32_dma_pm_suspend() returns -EBUSY when a channel is still enabled, without dropping the runtime PM reference it took, so the controller stays runtime resumed.

Call pm_runtime_put_sync() before returning -EBUSY.

Fixes 05f8740a0e6f ("dmaengine: stm32-dma: add suspend/resume power management support")
Quoted 16 lines
---
  drivers/dma/stm32/stm32-dma.c | 1 +
  1 file changed, 1 insertion(+)
drivers/dma/stm32/stm32-dma.c +1 -0
index ba8121d37f51..5e1bf8cdedb3 100644
@@ -1738,6 +1738,7 @@ static int stm32_dma_pm_suspend(struct device *dev)
  		scr = stm32_dma_read(dmadev, STM32_DMA_SCR(id));
  		if (scr & STM32_DMA_SCR_EN) {
  			dev_warn(dev, "Suspend is prevented by Chan %i\n", id);
+			pm_runtime_put_sync(dev);
  			return -EBUSY;
  		}
  	}