Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Takashi Iwai and committed by
Mark Brown
7369a2d9 f8d952c5

+8 -16
+2 -4
sound/soc/stm/stm32_i2s.c
··· 1352 1352 1353 1353 MODULE_DEVICE_TABLE(of, stm32_i2s_ids); 1354 1354 1355 - #ifdef CONFIG_PM_SLEEP 1356 1355 static int stm32_i2s_suspend(struct device *dev) 1357 1356 { 1358 1357 struct stm32_i2s_data *i2s = dev_get_drvdata(dev); ··· 1369 1370 regcache_cache_only(i2s->regmap, false); 1370 1371 return regcache_sync(i2s->regmap); 1371 1372 } 1372 - #endif /* CONFIG_PM_SLEEP */ 1373 1373 1374 1374 static const struct dev_pm_ops stm32_i2s_pm_ops = { 1375 - SET_SYSTEM_SLEEP_PM_OPS(stm32_i2s_suspend, stm32_i2s_resume) 1375 + SYSTEM_SLEEP_PM_OPS(stm32_i2s_suspend, stm32_i2s_resume) 1376 1376 }; 1377 1377 1378 1378 static struct platform_driver stm32_i2s_driver = { 1379 1379 .driver = { 1380 1380 .name = "st,stm32-i2s", 1381 1381 .of_match_table = stm32_i2s_ids, 1382 - .pm = &stm32_i2s_pm_ops, 1382 + .pm = pm_ptr(&stm32_i2s_pm_ops), 1383 1383 }, 1384 1384 .probe = stm32_i2s_probe, 1385 1385 .remove = stm32_i2s_remove,
+2 -4
sound/soc/stm/stm32_sai.c
··· 270 270 return devm_of_platform_populate(&pdev->dev); 271 271 } 272 272 273 - #ifdef CONFIG_PM_SLEEP 274 273 /* 275 274 * When pins are shared by two sai sub instances, pins have to be defined 276 275 * in sai parent node. In this case, pins state is not managed by alsa fw. ··· 304 305 305 306 return pinctrl_pm_select_default_state(dev); 306 307 } 307 - #endif /* CONFIG_PM_SLEEP */ 308 308 309 309 static const struct dev_pm_ops stm32_sai_pm_ops = { 310 - SET_SYSTEM_SLEEP_PM_OPS(stm32_sai_suspend, stm32_sai_resume) 310 + SYSTEM_SLEEP_PM_OPS(stm32_sai_suspend, stm32_sai_resume) 311 311 }; 312 312 313 313 MODULE_DEVICE_TABLE(of, stm32_sai_ids); ··· 315 317 .driver = { 316 318 .name = "st,stm32-sai", 317 319 .of_match_table = stm32_sai_ids, 318 - .pm = &stm32_sai_pm_ops, 320 + .pm = pm_ptr(&stm32_sai_pm_ops), 319 321 }, 320 322 .probe = stm32_sai_probe, 321 323 };
+2 -4
sound/soc/stm/stm32_sai_sub.c
··· 1704 1704 pm_runtime_disable(&pdev->dev); 1705 1705 } 1706 1706 1707 - #ifdef CONFIG_PM_SLEEP 1708 1707 static int stm32_sai_sub_suspend(struct device *dev) 1709 1708 { 1710 1709 struct stm32_sai_sub_data *sai = dev_get_drvdata(dev); ··· 1737 1738 1738 1739 return ret; 1739 1740 } 1740 - #endif /* CONFIG_PM_SLEEP */ 1741 1741 1742 1742 static const struct dev_pm_ops stm32_sai_sub_pm_ops = { 1743 - SET_SYSTEM_SLEEP_PM_OPS(stm32_sai_sub_suspend, stm32_sai_sub_resume) 1743 + SYSTEM_SLEEP_PM_OPS(stm32_sai_sub_suspend, stm32_sai_sub_resume) 1744 1744 }; 1745 1745 1746 1746 static struct platform_driver stm32_sai_sub_driver = { 1747 1747 .driver = { 1748 1748 .name = "st,stm32-sai-sub", 1749 1749 .of_match_table = stm32_sai_sub_ids, 1750 - .pm = &stm32_sai_sub_pm_ops, 1750 + .pm = pm_ptr(&stm32_sai_sub_pm_ops), 1751 1751 }, 1752 1752 .probe = stm32_sai_sub_probe, 1753 1753 .remove = stm32_sai_sub_remove,
+2 -4
sound/soc/stm/stm32_spdifrx.c
··· 1040 1040 1041 1041 MODULE_DEVICE_TABLE(of, stm32_spdifrx_ids); 1042 1042 1043 - #ifdef CONFIG_PM_SLEEP 1044 1043 static int stm32_spdifrx_suspend(struct device *dev) 1045 1044 { 1046 1045 struct stm32_spdifrx_data *spdifrx = dev_get_drvdata(dev); ··· 1058 1059 1059 1060 return regcache_sync(spdifrx->regmap); 1060 1061 } 1061 - #endif /* CONFIG_PM_SLEEP */ 1062 1062 1063 1063 static const struct dev_pm_ops stm32_spdifrx_pm_ops = { 1064 - SET_SYSTEM_SLEEP_PM_OPS(stm32_spdifrx_suspend, stm32_spdifrx_resume) 1064 + SYSTEM_SLEEP_PM_OPS(stm32_spdifrx_suspend, stm32_spdifrx_resume) 1065 1065 }; 1066 1066 1067 1067 static struct platform_driver stm32_spdifrx_driver = { 1068 1068 .driver = { 1069 1069 .name = "st,stm32-spdifrx", 1070 1070 .of_match_table = stm32_spdifrx_ids, 1071 - .pm = &stm32_spdifrx_pm_ops, 1071 + .pm = pm_ptr(&stm32_spdifrx_pm_ops), 1072 1072 }, 1073 1073 .probe = stm32_spdifrx_probe, 1074 1074 .remove = stm32_spdifrx_remove,