@@ -1352,7 +1352,6 @@ static int stm32_i2s_probe(struct platform_device *pdev)
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,
@@ -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,
};
@@ -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,
@@ -1040,7 +1040,6 @@ static int stm32_spdifrx_probe(struct platform_device *pdev)
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,
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> --- sound/soc/stm/stm32_i2s.c | 6 ++---- sound/soc/stm/stm32_sai.c | 6 ++---- sound/soc/stm/stm32_sai_sub.c | 6 ++---- sound/soc/stm/stm32_spdifrx.c | 6 ++---- 4 files changed, 8 insertions(+), 16 deletions(-)