ASoC: img: Convert to RUNTIME_PM_OPS() and co
authorTakashi Iwai <tiwai@suse.de>
Mon, 17 Mar 2025 09:55:22 +0000 (10:55 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 17 Mar 2025 10:14:40 +0000 (10:14 +0000)
Use the newer RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS() macros
instead of SET_RUNTIME_PM_OPS() and SET_SYSTEM_SLEEP_PM_OPS() together
with pm_ptr(), which allows us dropping superfluous CONFIG_PM_SLEEP
ifdefs.

This optimizes slightly when CONFIG_PM is disabled, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250317095603.20073-61-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/img/img-i2s-in.c
sound/soc/img/img-i2s-out.c
sound/soc/img/img-parallel-out.c
sound/soc/img/img-spdif-in.c
sound/soc/img/img-spdif-out.c
sound/soc/img/pistachio-internal-dac.c

index 6a988976fb0dee0c2b429f612ae500ce04b16dff..98d2ab68883a40f97c3b8dc4f7f4c9f9bc6f9064 100644 (file)
@@ -539,7 +539,6 @@ static void img_i2s_in_dev_remove(struct platform_device *pdev)
                img_i2s_in_runtime_suspend(&pdev->dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int img_i2s_in_suspend(struct device *dev)
 {
        struct img_i2s_in *i2s = dev_get_drvdata(dev);
@@ -586,7 +585,6 @@ static int img_i2s_in_resume(struct device *dev)
 
        return 0;
 }
-#endif
 
 static const struct of_device_id img_i2s_in_of_match[] = {
        { .compatible = "img,i2s-in" },
@@ -595,16 +593,15 @@ static const struct of_device_id img_i2s_in_of_match[] = {
 MODULE_DEVICE_TABLE(of, img_i2s_in_of_match);
 
 static const struct dev_pm_ops img_i2s_in_pm_ops = {
-       SET_RUNTIME_PM_OPS(img_i2s_in_runtime_suspend,
-                          img_i2s_in_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(img_i2s_in_suspend, img_i2s_in_resume)
+       RUNTIME_PM_OPS(img_i2s_in_runtime_suspend, img_i2s_in_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(img_i2s_in_suspend, img_i2s_in_resume)
 };
 
 static struct platform_driver img_i2s_in_driver = {
        .driver = {
                .name = "img-i2s-in",
                .of_match_table = img_i2s_in_of_match,
-               .pm = &img_i2s_in_pm_ops
+               .pm = pm_ptr(&img_i2s_in_pm_ops)
        },
        .probe = img_i2s_in_probe,
        .remove = img_i2s_in_dev_remove
index 1211e6184d97a07a3a4fb6a9052e5736326dd9e8..aedcf56a5359caf269f8db858df0ebd0825f42d6 100644 (file)
@@ -539,7 +539,6 @@ static void img_i2s_out_dev_remove(struct platform_device *pdev)
                img_i2s_out_runtime_suspend(&pdev->dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int img_i2s_out_suspend(struct device *dev)
 {
        struct img_i2s_out *i2s = dev_get_drvdata(dev);
@@ -586,7 +585,6 @@ static int img_i2s_out_resume(struct device *dev)
 
        return 0;
 }
-#endif
 
 static const struct of_device_id img_i2s_out_of_match[] = {
        { .compatible = "img,i2s-out" },
@@ -595,16 +593,15 @@ static const struct of_device_id img_i2s_out_of_match[] = {
 MODULE_DEVICE_TABLE(of, img_i2s_out_of_match);
 
 static const struct dev_pm_ops img_i2s_out_pm_ops = {
-       SET_RUNTIME_PM_OPS(img_i2s_out_runtime_suspend,
-                          img_i2s_out_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(img_i2s_out_suspend, img_i2s_out_resume)
+       RUNTIME_PM_OPS(img_i2s_out_runtime_suspend, img_i2s_out_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(img_i2s_out_suspend, img_i2s_out_resume)
 };
 
 static struct platform_driver img_i2s_out_driver = {
        .driver = {
                .name = "img-i2s-out",
                .of_match_table = img_i2s_out_of_match,
-               .pm = &img_i2s_out_pm_ops
+               .pm = pm_ptr(&img_i2s_out_pm_ops)
        },
        .probe = img_i2s_out_probe,
        .remove = img_i2s_out_dev_remove
index 4ec63119d67c54ca2e36e07335ab7643caa71f57..86b60e6dab38f08d43a47a9db905205c72f13a30 100644 (file)
@@ -300,15 +300,14 @@ static const struct of_device_id img_prl_out_of_match[] = {
 MODULE_DEVICE_TABLE(of, img_prl_out_of_match);
 
 static const struct dev_pm_ops img_prl_out_pm_ops = {
-       SET_RUNTIME_PM_OPS(img_prl_out_suspend,
-                          img_prl_out_resume, NULL)
+       RUNTIME_PM_OPS(img_prl_out_suspend, img_prl_out_resume, NULL)
 };
 
 static struct platform_driver img_prl_out_driver = {
        .driver = {
                .name = "img-parallel-out",
                .of_match_table = img_prl_out_of_match,
-               .pm = &img_prl_out_pm_ops
+               .pm = pm_ptr(&img_prl_out_pm_ops)
        },
        .probe = img_prl_out_probe,
        .remove = img_prl_out_dev_remove
index 3c513f5b8c54d7355c8ff5a26f6ac6e84e23af23..82295e2508fa73da4f464531810a703d7d959c65 100644 (file)
@@ -817,7 +817,6 @@ static void img_spdif_in_dev_remove(struct platform_device *pdev)
                img_spdif_in_runtime_suspend(&pdev->dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int img_spdif_in_suspend(struct device *dev)
 {
        struct img_spdif_in *spdif = dev_get_drvdata(dev);
@@ -857,7 +856,6 @@ static int img_spdif_in_resume(struct device *dev)
 
        return 0;
 }
-#endif
 
 static const struct of_device_id img_spdif_in_of_match[] = {
        { .compatible = "img,spdif-in" },
@@ -866,16 +864,15 @@ static const struct of_device_id img_spdif_in_of_match[] = {
 MODULE_DEVICE_TABLE(of, img_spdif_in_of_match);
 
 static const struct dev_pm_ops img_spdif_in_pm_ops = {
-       SET_RUNTIME_PM_OPS(img_spdif_in_runtime_suspend,
-                          img_spdif_in_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(img_spdif_in_suspend, img_spdif_in_resume)
+       RUNTIME_PM_OPS(img_spdif_in_runtime_suspend, img_spdif_in_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(img_spdif_in_suspend, img_spdif_in_resume)
 };
 
 static struct platform_driver img_spdif_in_driver = {
        .driver = {
                .name = "img-spdif-in",
                .of_match_table = img_spdif_in_of_match,
-               .pm = &img_spdif_in_pm_ops
+               .pm = pm_ptr(&img_spdif_in_pm_ops)
        },
        .probe = img_spdif_in_probe,
        .remove = img_spdif_in_dev_remove
index 402695b5fc41796a4db1344b1928530ebfc28e91..52f696219ef4ca0eb40709a9a19e6f3a766426b2 100644 (file)
@@ -409,7 +409,6 @@ static void img_spdif_out_dev_remove(struct platform_device *pdev)
                img_spdif_out_runtime_suspend(&pdev->dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int img_spdif_out_suspend(struct device *dev)
 {
        struct img_spdif_out *spdif = dev_get_drvdata(dev);
@@ -448,7 +447,7 @@ static int img_spdif_out_resume(struct device *dev)
 
        return 0;
 }
-#endif
+
 static const struct of_device_id img_spdif_out_of_match[] = {
        { .compatible = "img,spdif-out" },
        {}
@@ -456,16 +455,15 @@ static const struct of_device_id img_spdif_out_of_match[] = {
 MODULE_DEVICE_TABLE(of, img_spdif_out_of_match);
 
 static const struct dev_pm_ops img_spdif_out_pm_ops = {
-       SET_RUNTIME_PM_OPS(img_spdif_out_runtime_suspend,
-                          img_spdif_out_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(img_spdif_out_suspend, img_spdif_out_resume)
+       RUNTIME_PM_OPS(img_spdif_out_runtime_suspend, img_spdif_out_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(img_spdif_out_suspend, img_spdif_out_resume)
 };
 
 static struct platform_driver img_spdif_out_driver = {
        .driver = {
                .name = "img-spdif-out",
                .of_match_table = img_spdif_out_of_match,
-               .pm = &img_spdif_out_pm_ops
+               .pm = pm_ptr(&img_spdif_out_pm_ops)
        },
        .probe = img_spdif_out_probe,
        .remove = img_spdif_out_dev_remove
index fdeceb271e7ff4541d38c3a8bc8219667a3fadb9..ec4f891295c931535ccd1db9b5d324c798ba29e7 100644 (file)
@@ -224,7 +224,6 @@ static void pistachio_internal_dac_remove(struct platform_device *pdev)
        regulator_disable(dac->supply);
 }
 
-#ifdef CONFIG_PM
 static int pistachio_internal_dac_rt_resume(struct device *dev)
 {
        struct pistachio_internal_dac *dac = dev_get_drvdata(dev);
@@ -251,11 +250,10 @@ static int pistachio_internal_dac_rt_suspend(struct device *dev)
 
        return 0;
 }
-#endif
 
 static const struct dev_pm_ops pistachio_internal_dac_pm_ops = {
-       SET_RUNTIME_PM_OPS(pistachio_internal_dac_rt_suspend,
-                       pistachio_internal_dac_rt_resume, NULL)
+       RUNTIME_PM_OPS(pistachio_internal_dac_rt_suspend,
+                      pistachio_internal_dac_rt_resume, NULL)
 };
 
 static const struct of_device_id pistachio_internal_dac_of_match[] = {
@@ -268,7 +266,7 @@ static struct platform_driver pistachio_internal_dac_plat_driver = {
        .driver = {
                .name = "img-pistachio-internal-dac",
                .of_match_table = pistachio_internal_dac_of_match,
-               .pm = &pistachio_internal_dac_pm_ops
+               .pm = pm_ptr(&pistachio_internal_dac_pm_ops)
        },
        .probe = pistachio_internal_dac_probe,
        .remove = pistachio_internal_dac_remove