ASoC: stm: Convert to SYSTEM_SLEEP_PM_OPS()

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>
This commit is contained in:
Takashi Iwai 2025-03-17 10:55:42 +01:00 committed by Mark Brown
parent f8d952c5f7
commit 7369a2d958
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
4 changed files with 8 additions and 16 deletions

View 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,

View 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,
};

View 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,

View 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,