diff mbox series

[2/3] ASoC: fsl: fsl_easrc: Switch to RUNTIME_PM_OPS()

Message ID 20240507173735.3456334-2-festevam@gmail.com (mailing list archive)
State Superseded
Headers show
Series [1/3] ASoC: fsl: fsl_aud2htx: Switch to RUNTIME_PM_OPS() | expand

Commit Message

Fabio Estevam May 7, 2024, 5:37 p.m. UTC
From: Fabio Estevam <festevam@denx.de>

Replace SET_RUNTIME_PM_OPS() with its modern alternative RUNTIME_PM_OPS().

The combined usage of pm_ptr() and RUNTIME_PM_OPS() allows the
compiler to evaluate if the runtime suspend/resume() functions are used
at build time or are simply dead code.

This allows removing the __maybe_unused notation from the runtime
suspend/resume() functions.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
 sound/soc/fsl/fsl_easrc.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Shengjiu Wang May 17, 2024, 3:07 a.m. UTC | #1
On Wed, May 8, 2024 at 1:37 AM Fabio Estevam <festevam@gmail.com> wrote:
>
> From: Fabio Estevam <festevam@denx.de>
>
> Replace SET_RUNTIME_PM_OPS() with its modern alternative RUNTIME_PM_OPS().
>
> The combined usage of pm_ptr() and RUNTIME_PM_OPS() allows the
> compiler to evaluate if the runtime suspend/resume() functions are used
> at build time or are simply dead code.
>
> This allows removing the __maybe_unused notation from the runtime
> suspend/resume() functions.
>
> Signed-off-by: Fabio Estevam <festevam@denx.de>

Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>

Best regards
Shengjiu Wang

> ---
>  sound/soc/fsl/fsl_easrc.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
> index ec53bda46a46..962f30912091 100644
> --- a/sound/soc/fsl/fsl_easrc.c
> +++ b/sound/soc/fsl/fsl_easrc.c
> @@ -1988,7 +1988,7 @@ static void fsl_easrc_remove(struct platform_device *pdev)
>         pm_runtime_disable(&pdev->dev);
>  }
>
> -static __maybe_unused int fsl_easrc_runtime_suspend(struct device *dev)
> +static int fsl_easrc_runtime_suspend(struct device *dev)
>  {
>         struct fsl_asrc *easrc = dev_get_drvdata(dev);
>         struct fsl_easrc_priv *easrc_priv = easrc->private;
> @@ -2005,7 +2005,7 @@ static __maybe_unused int fsl_easrc_runtime_suspend(struct device *dev)
>         return 0;
>  }
>
> -static __maybe_unused int fsl_easrc_runtime_resume(struct device *dev)
> +static int fsl_easrc_runtime_resume(struct device *dev)
>  {
>         struct fsl_asrc *easrc = dev_get_drvdata(dev);
>         struct fsl_easrc_priv *easrc_priv = easrc->private;
> @@ -2086,9 +2086,7 @@ static __maybe_unused int fsl_easrc_runtime_resume(struct device *dev)
>  }
>
>  static const struct dev_pm_ops fsl_easrc_pm_ops = {
> -       SET_RUNTIME_PM_OPS(fsl_easrc_runtime_suspend,
> -                          fsl_easrc_runtime_resume,
> -                          NULL)
> +       RUNTIME_PM_OPS(fsl_easrc_runtime_suspend, fsl_easrc_runtime_resume, NULL)
>         SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
>                                 pm_runtime_force_resume)
>  };
> @@ -2098,7 +2096,7 @@ static struct platform_driver fsl_easrc_driver = {
>         .remove_new = fsl_easrc_remove,
>         .driver = {
>                 .name = "fsl-easrc",
> -               .pm = &fsl_easrc_pm_ops,
> +               .pm = pm_ptr(&fsl_easrc_pm_ops),
>                 .of_match_table = fsl_easrc_dt_ids,
>         },
>  };
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
index ec53bda46a46..962f30912091 100644
--- a/sound/soc/fsl/fsl_easrc.c
+++ b/sound/soc/fsl/fsl_easrc.c
@@ -1988,7 +1988,7 @@  static void fsl_easrc_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 }
 
-static __maybe_unused int fsl_easrc_runtime_suspend(struct device *dev)
+static int fsl_easrc_runtime_suspend(struct device *dev)
 {
 	struct fsl_asrc *easrc = dev_get_drvdata(dev);
 	struct fsl_easrc_priv *easrc_priv = easrc->private;
@@ -2005,7 +2005,7 @@  static __maybe_unused int fsl_easrc_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static __maybe_unused int fsl_easrc_runtime_resume(struct device *dev)
+static int fsl_easrc_runtime_resume(struct device *dev)
 {
 	struct fsl_asrc *easrc = dev_get_drvdata(dev);
 	struct fsl_easrc_priv *easrc_priv = easrc->private;
@@ -2086,9 +2086,7 @@  static __maybe_unused int fsl_easrc_runtime_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops fsl_easrc_pm_ops = {
-	SET_RUNTIME_PM_OPS(fsl_easrc_runtime_suspend,
-			   fsl_easrc_runtime_resume,
-			   NULL)
+	RUNTIME_PM_OPS(fsl_easrc_runtime_suspend, fsl_easrc_runtime_resume, NULL)
 	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
 				pm_runtime_force_resume)
 };
@@ -2098,7 +2096,7 @@  static struct platform_driver fsl_easrc_driver = {
 	.remove_new = fsl_easrc_remove,
 	.driver = {
 		.name = "fsl-easrc",
-		.pm = &fsl_easrc_pm_ops,
+		.pm = pm_ptr(&fsl_easrc_pm_ops),
 		.of_match_table = fsl_easrc_dt_ids,
 	},
 };