Skip to contentSkip to conversation

dmaengine: ti: k3-udma: define udma_pm_resume,suspend with CONFIG_PM_SLEEP

PATCH In review Tom Rix 2 participants 2 messages May 1, 2023 – May 16, 2023

Subsystems (2)
lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 dmaengine: ti: k3-udma: define udma_pm_resume,suspend with CONFIG_PM_SLEEP

gcc reports
drivers/dma/ti/k3-udma.c:5552:12: error: ‘udma_pm_resume’
defined but not used [-Werror=unused-function]
5552 | static int udma_pm_resume(struct device *dev)

      |            ^~~~~~~~~~~~~~
drivers/dma/ti/k3-udma.c:5530:12: error: ‘udma_pm_suspend’
  defined but not used [-Werror=unused-function]
 5530 | static int udma_pm_suspend(struct device *dev)
      |            ^~~~~~~~~~~~~~~

These functions are used conditionally with CONFIG_PM_SLEEP, so they should be likewise defined.

---
 drivers/dma/ti/k3-udma.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/dma/ti/k3-udma.c +2 -0
index fc3a2a05ab7b..f189b0f2e423 100644
@@ -5527,6 +5527,7 @@ static int udma_probe(struct platform_device *pdev)
 	return ret;
 }
 
+#ifdef CONFIG_PM_SLEEP
 static int udma_pm_suspend(struct device *dev)
 {
 	struct udma_dev *ud = dev_get_drvdata(dev);
@@ -5573,6 +5574,7 @@ static int udma_pm_resume(struct device *dev)
 
 	return 0;
 }
+#endif
 
 static const struct dev_pm_ops udma_pm_ops = {
 	SET_LATE_SYSTEM_SLEEP_PM_OPS(udma_pm_suspend, udma_pm_resume)
Signature · 1 line
2.27.0
maintainer
#1 lore raw
Quoted 4 lines · Tom Rix

gcc reports
drivers/dma/ti/k3-udma.c:5552:12: error: ‘udma_pm_resume’
defined but not used [-Werror=unused-function]
5552 | static int udma_pm_resume(struct device *dev)

Quoted 8 lines
      |            ^~~~~~~~~~~~~~
drivers/dma/ti/k3-udma.c:5530:12: error: ‘udma_pm_suspend’
  defined but not used [-Werror=unused-function]
 5530 | static int udma_pm_suspend(struct device *dev)
      |            ^~~~~~~~~~~~~~~

These functions are used conditionally with CONFIG_PM_SLEEP, so they should be likewise defined.

A better way would be to use __maybe_unused. I have sent a patch with that change

Quoted 28 lines
---
 drivers/dma/ti/k3-udma.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/dma/ti/k3-udma.c +2 -0
index fc3a2a05ab7b..f189b0f2e423 100644
@@ -5527,6 +5527,7 @@ static int udma_probe(struct platform_device *pdev)
 	return ret;
 }
 
+#ifdef CONFIG_PM_SLEEP
 static int udma_pm_suspend(struct device *dev)
 {
 	struct udma_dev *ud = dev_get_drvdata(dev);
@@ -5573,6 +5574,7 @@ static int udma_pm_resume(struct device *dev)
 
 	return 0;
 }
+#endif
 
 static const struct dev_pm_ops udma_pm_ops = {
 	SET_LATE_SYSTEM_SLEEP_PM_OPS(udma_pm_suspend, udma_pm_resume)
Signature · 1 line
2.27.0
Signature · 1 line
~Vinod