ASoC: imx-pcm-rpmsg: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()
authorFabio Estevam <festevam@denx.de>
Thu, 8 Aug 2024 18:49:44 +0000 (15:49 -0300)
committerMark Brown <broonie@kernel.org>
Wed, 14 Aug 2024 17:21:18 +0000 (18:21 +0100)
Replace SET_RUNTIME_PM_OPS()/SET SYSTEM_SLEEP_PM_OPS() with their modern
RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS() alternatives.

The combined usage of pm_ptr() and RUNTIME_PM_OPS/SYSTEM_SLEEP_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 CONFIG_PM ifdefery from the runtime
suspend/resume() functions.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Link: https://patch.msgid.link/20240808184944.267686-7-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/imx-pcm-rpmsg.c

index b0944a07ab470a5f852500d4d7b134f374c3d352..22156f99dceeaeec2cff8f4b24691b303e057a0d 100644 (file)
@@ -753,7 +753,6 @@ static void imx_rpmsg_pcm_remove(struct platform_device *pdev)
                destroy_workqueue(info->rpmsg_wq);
 }
 
-#ifdef CONFIG_PM
 static int imx_rpmsg_pcm_runtime_resume(struct device *dev)
 {
        struct rpmsg_info *info = dev_get_drvdata(dev);
@@ -771,9 +770,7 @@ static int imx_rpmsg_pcm_runtime_suspend(struct device *dev)
 
        return 0;
 }
-#endif
 
-#ifdef CONFIG_PM_SLEEP
 static int imx_rpmsg_pcm_suspend(struct device *dev)
 {
        struct rpmsg_info *info = dev_get_drvdata(dev);
@@ -809,14 +806,11 @@ static int imx_rpmsg_pcm_resume(struct device *dev)
 
        return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops imx_rpmsg_pcm_pm_ops = {
-       SET_RUNTIME_PM_OPS(imx_rpmsg_pcm_runtime_suspend,
-                          imx_rpmsg_pcm_runtime_resume,
-                          NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(imx_rpmsg_pcm_suspend,
-                               imx_rpmsg_pcm_resume)
+       RUNTIME_PM_OPS(imx_rpmsg_pcm_runtime_suspend,
+                      imx_rpmsg_pcm_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(imx_rpmsg_pcm_suspend, imx_rpmsg_pcm_resume)
 };
 
 static const struct platform_device_id imx_rpmsg_pcm_id_table[] = {
@@ -832,7 +826,7 @@ static struct platform_driver imx_pcm_rpmsg_driver = {
        .id_table = imx_rpmsg_pcm_id_table,
        .driver = {
                .name = IMX_PCM_DRV_NAME,
-               .pm = &imx_rpmsg_pcm_pm_ops,
+               .pm = pm_ptr(&imx_rpmsg_pcm_pm_ops),
        },
 };
 module_platform_driver(imx_pcm_rpmsg_driver);