Skip to contentSkip to conversation

remoteproc: imx_dsp_rproc: use modern pm_ops

PATCH Applied Arnd Bergmann 4 participants 4 messages Apr 20, 2023 – May 9, 2023

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

PATCH 1/1 remoteproc: imx_dsp_rproc: use modern pm_ops

From: Arnd Bergmann <[email protected]>

Without CONFIG_PM, the driver warns about unused functions:

drivers/remoteproc/imx_dsp_rproc.c:1210:12: error: 'imx_dsp_runtime_suspend' defined but not used [-Werror=unused-function]
1210 | static int imx_dsp_runtime_suspend(struct device *dev)

      |            ^~~~~~~~~~~~~~~~~~~~~~~
drivers/remoteproc/imx_dsp_rproc.c:1178:12: error: 'imx_dsp_runtime_resume' defined but not used [-Werror=unused-function]
 1178 | static int imx_dsp_runtime_resume(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~

Change the old SET_SYSTEM_SLEEP_PM_OPS()/SET_RUNTIME_PM_OPS() helpers to their modern replacements that avoid the warning, and remove the now unnecessary __maybe_unused annotations on the other PM helper functions.

---
 drivers/remoteproc/imx_dsp_rproc.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/remoteproc/imx_dsp_rproc.c +5 -6
index cab06dbf37fb..2d75dea43f20 100644
@@ -1243,7 +1243,7 @@ static void imx_dsp_load_firmware(const struct firmware *fw, void *context)
 	release_firmware(fw);
 }
 
-static __maybe_unused int imx_dsp_suspend(struct device *dev)
+static int imx_dsp_suspend(struct device *dev)
 {
 	struct rproc *rproc = dev_get_drvdata(dev);
 	struct imx_dsp_rproc *priv = rproc->priv;
@@ -1278,7 +1278,7 @@ static __maybe_unused int imx_dsp_suspend(struct device *dev)
 	return pm_runtime_force_suspend(dev);
 }
 
-static __maybe_unused int imx_dsp_resume(struct device *dev)
+static int imx_dsp_resume(struct device *dev)
 {
 	struct rproc *rproc = dev_get_drvdata(dev);
 	int ret = 0;
@@ -1312,9 +1312,8 @@ static __maybe_unused int imx_dsp_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops imx_dsp_rproc_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(imx_dsp_suspend, imx_dsp_resume)
-	SET_RUNTIME_PM_OPS(imx_dsp_runtime_suspend,
-			   imx_dsp_runtime_resume, NULL)
+	SYSTEM_SLEEP_PM_OPS(imx_dsp_suspend, imx_dsp_resume)
+	RUNTIME_PM_OPS(imx_dsp_runtime_suspend, imx_dsp_runtime_resume, NULL)
 };
 
 static const struct of_device_id imx_dsp_rproc_of_match[] = {
@@ -1332,7 +1331,7 @@ static struct platform_driver imx_dsp_rproc_driver = {
 	.driver = {
 		.name = "imx-dsp-rproc",
 		.of_match_table = imx_dsp_rproc_of_match,
-		.pm = &imx_dsp_rproc_pm_ops,
+		.pm = pm_ptr(&imx_dsp_rproc_pm_ops),
 	},
 };
 module_platform_driver(imx_dsp_rproc_driver);
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 56 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Without CONFIG_PM, the driver warns about unused functions:

drivers/remoteproc/imx_dsp_rproc.c:1210:12: error: 'imx_dsp_runtime_suspend' defined but not used [-Werror=unused-function]
1210 | static int imx_dsp_runtime_suspend(struct device *dev)

       |            ^~~~~~~~~~~~~~~~~~~~~~~
drivers/remoteproc/imx_dsp_rproc.c:1178:12: error: 'imx_dsp_runtime_resume' defined but not used [-Werror=unused-function]
  1178 | static int imx_dsp_runtime_resume(struct device *dev)
       |            ^~~~~~~~~~~~~~~~~~~~~~

Change the old SET_SYSTEM_SLEEP_PM_OPS()/SET_RUNTIME_PM_OPS() helpers to their modern replacements that avoid the warning, and remove the now unnecessary __maybe_unused annotations on the other PM helper functions.

---
  drivers/remoteproc/imx_dsp_rproc.c | 11 +++++------
  1 file changed, 5 insertions(+), 6 deletions(-)
drivers/remoteproc/imx_dsp_rproc.c +4 -5
index cab06dbf37fb..2d75dea43f20 100644
@@ -1243,7 +1243,7 @@ static void imx_dsp_load_firmware(const struct firmware *fw, void *context)
  	release_firmware(fw);
  }
 
-static __maybe_unused int imx_dsp_suspend(struct device *dev)
+static int imx_dsp_suspend(struct device *dev)
  {
  	struct rproc *rproc = dev_get_drvdata(dev);
  	struct imx_dsp_rproc *priv = rproc->priv;
@@ -1278,7 +1278,7 @@ static __maybe_unused int imx_dsp_suspend(struct device *dev)
  	return pm_runtime_force_suspend(dev);
  }
 
-static __maybe_unused int imx_dsp_resume(struct device *dev)
+static int imx_dsp_resume(struct device *dev)
  {
  	struct rproc *rproc = dev_get_drvdata(dev);
  	int ret = 0;
@@ -1312,9 +1312,8 @@ static __maybe_unused int imx_dsp_resume(struct device *dev)
  }
 
  static const struct dev_pm_ops imx_dsp_rproc_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(imx_dsp_suspend, imx_dsp_resume)
-	SET_RUNTIME_PM_OPS(imx_dsp_runtime_suspend,
-			   imx_dsp_runtime_resume, NULL)
+	SYSTEM_SLEEP_PM_OPS(imx_dsp_suspend, imx_dsp_resume)
+	RUNTIME_PM_OPS(imx_dsp_runtime_suspend, imx_dsp_runtime_resume, NULL)
  };
 
  static const struct of_device_id imx_dsp_rproc_of_match[] = {

drivers/remoteproc/imx_dsp_rproc.c static struct platform_driver imx_dsp_rproc_driver = { · line 1334

Quoted 5 lines
drivers/remoteproc/imx_dsp_rproc.c +1 -1
@@ -1332,7 +1331,7 @@ static struct platform_driver imx_dsp_rproc_driver = {
  	.driver = {
  		.name = "imx-dsp-rproc",
  		.of_match_table = imx_dsp_rproc_of_match,
-		.pm = &imx_dsp_rproc_pm_ops,
+		.pm = pm_ptr(&imx_dsp_rproc_pm_ops),

LGTM.

-Mukesh

Quoted 3 lines
drivers/remoteproc/imx_dsp_rproc.c +0 -0
  	},
  };
  module_platform_driver(imx_dsp_rproc_driver);
Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Without CONFIG_PM, the driver warns about unused functions:

drivers/remoteproc/imx_dsp_rproc.c:1210:12: error: 'imx_dsp_runtime_suspend' defined but not used [-Werror=unused-function]
1210 | static int imx_dsp_runtime_suspend(struct device *dev)

       |            ^~~~~~~~~~~~~~~~~~~~~~~
drivers/remoteproc/imx_dsp_rproc.c:1178:12: error: 'imx_dsp_runtime_resume' defined but not used [-Werror=unused-function]
  1178 | static int imx_dsp_runtime_resume(struct device *dev)
       |            ^~~~~~~~~~~~~~~~~~~~~~
Quoted 6 lines

Change the old SET_SYSTEM_SLEEP_PM_OPS()/SET_RUNTIME_PM_OPS() helpers to their modern replacements that avoid the warning, and remove the now unnecessary __maybe_unused annotations on the other PM helper functions.

Thanks,
Iulia

Quoted 47 lines
---
  drivers/remoteproc/imx_dsp_rproc.c | 11 +++++------
  1 file changed, 5 insertions(+), 6 deletions(-)
drivers/remoteproc/imx_dsp_rproc.c +5 -6
index cab06dbf37fb..2d75dea43f20 100644
@@ -1243,7 +1243,7 @@ static void imx_dsp_load_firmware(const struct firmware *fw, void *context)
  	release_firmware(fw);
  }
 
-static __maybe_unused int imx_dsp_suspend(struct device *dev)
+static int imx_dsp_suspend(struct device *dev)
  {
  	struct rproc *rproc = dev_get_drvdata(dev);
  	struct imx_dsp_rproc *priv = rproc->priv;
@@ -1278,7 +1278,7 @@ static __maybe_unused int imx_dsp_suspend(struct device *dev)
  	return pm_runtime_force_suspend(dev);
  }
 
-static __maybe_unused int imx_dsp_resume(struct device *dev)
+static int imx_dsp_resume(struct device *dev)
  {
  	struct rproc *rproc = dev_get_drvdata(dev);
  	int ret = 0;
@@ -1312,9 +1312,8 @@ static __maybe_unused int imx_dsp_resume(struct device *dev)
  }
 
  static const struct dev_pm_ops imx_dsp_rproc_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(imx_dsp_suspend, imx_dsp_resume)
-	SET_RUNTIME_PM_OPS(imx_dsp_runtime_suspend,
-			   imx_dsp_runtime_resume, NULL)
+	SYSTEM_SLEEP_PM_OPS(imx_dsp_suspend, imx_dsp_resume)
+	RUNTIME_PM_OPS(imx_dsp_runtime_suspend, imx_dsp_runtime_resume, NULL)
  };
 
  static const struct of_device_id imx_dsp_rproc_of_match[] = {
@@ -1332,7 +1331,7 @@ static struct platform_driver imx_dsp_rproc_driver = {
  	.driver = {
  		.name = "imx-dsp-rproc",
  		.of_match_table = imx_dsp_rproc_of_match,
-		.pm = &imx_dsp_rproc_pm_ops,
+		.pm = pm_ptr(&imx_dsp_rproc_pm_ops),
  	},
  };
  module_platform_driver(imx_dsp_rproc_driver);
maintainer Applied
#3 lore raw
In reply to Arnd Bergmann
Quoted 16 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Without CONFIG_PM, the driver warns about unused functions:

drivers/remoteproc/imx_dsp_rproc.c:1210:12: error: 'imx_dsp_runtime_suspend' defined but not used [-Werror=unused-function]
1210 | static int imx_dsp_runtime_suspend(struct device *dev)

      |            ^~~~~~~~~~~~~~~~~~~~~~~
drivers/remoteproc/imx_dsp_rproc.c:1178:12: error: 'imx_dsp_runtime_resume' defined but not used [-Werror=unused-function]
 1178 | static int imx_dsp_runtime_resume(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~

Change the old SET_SYSTEM_SLEEP_PM_OPS()/SET_RUNTIME_PM_OPS() helpers to their modern replacements that avoid the warning, and remove the now unnecessary __maybe_unused annotations on the other PM helper functions.

Quoted 5 lines
---
 drivers/remoteproc/imx_dsp_rproc.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Applied.

Thanks,
Mathieu

Quoted 46 lines
drivers/remoteproc/imx_dsp_rproc.c +5 -6
index cab06dbf37fb..2d75dea43f20 100644
@@ -1243,7 +1243,7 @@ static void imx_dsp_load_firmware(const struct firmware *fw, void *context)
 	release_firmware(fw);
 }
 
-static __maybe_unused int imx_dsp_suspend(struct device *dev)
+static int imx_dsp_suspend(struct device *dev)
 {
 	struct rproc *rproc = dev_get_drvdata(dev);
 	struct imx_dsp_rproc *priv = rproc->priv;
@@ -1278,7 +1278,7 @@ static __maybe_unused int imx_dsp_suspend(struct device *dev)
 	return pm_runtime_force_suspend(dev);
 }
 
-static __maybe_unused int imx_dsp_resume(struct device *dev)
+static int imx_dsp_resume(struct device *dev)
 {
 	struct rproc *rproc = dev_get_drvdata(dev);
 	int ret = 0;
@@ -1312,9 +1312,8 @@ static __maybe_unused int imx_dsp_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops imx_dsp_rproc_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(imx_dsp_suspend, imx_dsp_resume)
-	SET_RUNTIME_PM_OPS(imx_dsp_runtime_suspend,
-			   imx_dsp_runtime_resume, NULL)
+	SYSTEM_SLEEP_PM_OPS(imx_dsp_suspend, imx_dsp_resume)
+	RUNTIME_PM_OPS(imx_dsp_runtime_suspend, imx_dsp_runtime_resume, NULL)
 };
 
 static const struct of_device_id imx_dsp_rproc_of_match[] = {
@@ -1332,7 +1331,7 @@ static struct platform_driver imx_dsp_rproc_driver = {
 	.driver = {
 		.name = "imx-dsp-rproc",
 		.of_match_table = imx_dsp_rproc_of_match,
-		.pm = &imx_dsp_rproc_pm_ops,
+		.pm = pm_ptr(&imx_dsp_rproc_pm_ops),
 	},
 };
 module_platform_driver(imx_dsp_rproc_driver);
Signature · 1 line
2.39.2