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

mmc: wmt-sdmmc: use modern PM macros

Use the modern PM macros for the suspend and resume functions to be
automatically dropped by the compiler when CONFIG_PM or
CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Link: https://lore.kernel.org/r/20250815013413.28641-32-jszhang@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Jisheng Zhang and committed by
Ulf Hansson
8a40405a a120f217

+2 -14
+2 -14
drivers/mmc/host/wmt-sdmmc.c
··· 911 911 dev_info(&pdev->dev, "WMT MCI device removed\n"); 912 912 } 913 913 914 - #ifdef CONFIG_PM 915 914 static int wmt_mci_suspend(struct device *dev) 916 915 { 917 916 u32 reg_tmp; ··· 962 963 return 0; 963 964 } 964 965 965 - static const struct dev_pm_ops wmt_mci_pm = { 966 - .suspend = wmt_mci_suspend, 967 - .resume = wmt_mci_resume, 968 - }; 969 - 970 - #define wmt_mci_pm_ops (&wmt_mci_pm) 971 - 972 - #else /* !CONFIG_PM */ 973 - 974 - #define wmt_mci_pm_ops NULL 975 - 976 - #endif 966 + static DEFINE_SIMPLE_DEV_PM_OPS(wmt_mci_pm_ops, wmt_mci_suspend, wmt_mci_resume); 977 967 978 968 static struct platform_driver wmt_mci_driver = { 979 969 .probe = wmt_mci_probe, ··· 970 982 .driver = { 971 983 .name = DRIVER_NAME, 972 984 .probe_type = PROBE_PREFER_ASYNCHRONOUS, 973 - .pm = wmt_mci_pm_ops, 985 + .pm = pm_sleep_ptr(&wmt_mci_pm_ops), 974 986 .of_match_table = wmt_mci_dt_ids, 975 987 }, 976 988 };