]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: stm: Convert to SYSTEM_SLEEP_PM_OPS()
authorTakashi Iwai <tiwai@suse.de>
Mon, 17 Mar 2025 09:55:42 +0000 (10:55 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 17 Mar 2025 10:14:58 +0000 (10:14 +0000)
Use the newer SYSTEM_SLEEP_PM_OPS() macro instead
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.

Cc: Olivier Moysan <olivier.moysan@foss.st.com>
Cc: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250317095603.20073-81-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/stm/stm32_i2s.c
sound/soc/stm/stm32_sai.c
sound/soc/stm/stm32_sai_sub.c
sound/soc/stm/stm32_spdifrx.c

index 19dc61008a75f3d0dee31a40afb95a4370f8b16c..6037b7a9c97bf25621fccb1feb59c4caee3250ca 100644 (file)
@@ -1352,7 +1352,6 @@ error:
 
 MODULE_DEVICE_TABLE(of, stm32_i2s_ids);
 
-#ifdef CONFIG_PM_SLEEP
 static int stm32_i2s_suspend(struct device *dev)
 {
        struct stm32_i2s_data *i2s = dev_get_drvdata(dev);
@@ -1370,17 +1369,16 @@ static int stm32_i2s_resume(struct device *dev)
        regcache_cache_only(i2s->regmap, false);
        return regcache_sync(i2s->regmap);
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops stm32_i2s_pm_ops = {
-       SET_SYSTEM_SLEEP_PM_OPS(stm32_i2s_suspend, stm32_i2s_resume)
+       SYSTEM_SLEEP_PM_OPS(stm32_i2s_suspend, stm32_i2s_resume)
 };
 
 static struct platform_driver stm32_i2s_driver = {
        .driver = {
                .name = "st,stm32-i2s",
                .of_match_table = stm32_i2s_ids,
-               .pm = &stm32_i2s_pm_ops,
+               .pm = pm_ptr(&stm32_i2s_pm_ops),
        },
        .probe = stm32_i2s_probe,
        .remove = stm32_i2s_remove,
index bc8180fc8462db6fd5a7ec325369139231d7c7de..504a14584765eccbb6882cf731a80e9e16259eb9 100644 (file)
@@ -270,7 +270,6 @@ static int stm32_sai_probe(struct platform_device *pdev)
        return devm_of_platform_populate(&pdev->dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 /*
  * When pins are shared by two sai sub instances, pins have to be defined
  * in sai parent node. In this case, pins state is not managed by alsa fw.
@@ -305,10 +304,9 @@ static int stm32_sai_resume(struct device *dev)
 
        return pinctrl_pm_select_default_state(dev);
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops stm32_sai_pm_ops = {
-       SET_SYSTEM_SLEEP_PM_OPS(stm32_sai_suspend, stm32_sai_resume)
+       SYSTEM_SLEEP_PM_OPS(stm32_sai_suspend, stm32_sai_resume)
 };
 
 MODULE_DEVICE_TABLE(of, stm32_sai_ids);
@@ -317,7 +315,7 @@ static struct platform_driver stm32_sai_driver = {
        .driver = {
                .name = "st,stm32-sai",
                .of_match_table = stm32_sai_ids,
-               .pm = &stm32_sai_pm_ops,
+               .pm = pm_ptr(&stm32_sai_pm_ops),
        },
        .probe = stm32_sai_probe,
 };
index 3efbf4aaf9654958af7169487001b9d3b6c1e050..e8c1abf1ae0a70627a2a294cff01d7566f35d7da 100644 (file)
@@ -1704,7 +1704,6 @@ static void stm32_sai_sub_remove(struct platform_device *pdev)
        pm_runtime_disable(&pdev->dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int stm32_sai_sub_suspend(struct device *dev)
 {
        struct stm32_sai_sub_data *sai = dev_get_drvdata(dev);
@@ -1738,17 +1737,16 @@ static int stm32_sai_sub_resume(struct device *dev)
 
        return ret;
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops stm32_sai_sub_pm_ops = {
-       SET_SYSTEM_SLEEP_PM_OPS(stm32_sai_sub_suspend, stm32_sai_sub_resume)
+       SYSTEM_SLEEP_PM_OPS(stm32_sai_sub_suspend, stm32_sai_sub_resume)
 };
 
 static struct platform_driver stm32_sai_sub_driver = {
        .driver = {
                .name = "st,stm32-sai-sub",
                .of_match_table = stm32_sai_sub_ids,
-               .pm = &stm32_sai_sub_pm_ops,
+               .pm = pm_ptr(&stm32_sai_sub_pm_ops),
        },
        .probe = stm32_sai_sub_probe,
        .remove = stm32_sai_sub_remove,
index 9e30852de93cdf471da1f6b02fa0b2ba60384c44..57b711c442784577cdac9b34489d3d305ddf50ee 100644 (file)
@@ -1040,7 +1040,6 @@ error:
 
 MODULE_DEVICE_TABLE(of, stm32_spdifrx_ids);
 
-#ifdef CONFIG_PM_SLEEP
 static int stm32_spdifrx_suspend(struct device *dev)
 {
        struct stm32_spdifrx_data *spdifrx = dev_get_drvdata(dev);
@@ -1059,17 +1058,16 @@ static int stm32_spdifrx_resume(struct device *dev)
 
        return regcache_sync(spdifrx->regmap);
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops stm32_spdifrx_pm_ops = {
-       SET_SYSTEM_SLEEP_PM_OPS(stm32_spdifrx_suspend, stm32_spdifrx_resume)
+       SYSTEM_SLEEP_PM_OPS(stm32_spdifrx_suspend, stm32_spdifrx_resume)
 };
 
 static struct platform_driver stm32_spdifrx_driver = {
        .driver = {
                .name = "st,stm32-spdifrx",
                .of_match_table = stm32_spdifrx_ids,
-               .pm = &stm32_spdifrx_pm_ops,
+               .pm = pm_ptr(&stm32_spdifrx_pm_ops),
        },
        .probe = stm32_spdifrx_probe,
        .remove = stm32_spdifrx_remove,