mmc: au1xmmc: 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.

At the same time, replace the platform_driver's .suspend and .resume
usage with modern device_driver's .pm usage.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Link: https://lore.kernel.org/r/20250815013413.28641-9-jszhang@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
Jisheng Zhang 2025-08-15 09:33:43 +08:00 committed by Ulf Hansson
parent ce4b13cb30
commit 3d3c95796a
1 changed files with 7 additions and 11 deletions

View File

@ -1150,10 +1150,9 @@ static void au1xmmc_remove(struct platform_device *pdev)
} }
} }
#ifdef CONFIG_PM static int au1xmmc_suspend(struct device *dev)
static int au1xmmc_suspend(struct platform_device *pdev, pm_message_t state)
{ {
struct au1xmmc_host *host = platform_get_drvdata(pdev); struct au1xmmc_host *host = dev_get_drvdata(dev);
__raw_writel(0, HOST_CONFIG2(host)); __raw_writel(0, HOST_CONFIG2(host));
__raw_writel(0, HOST_CONFIG(host)); __raw_writel(0, HOST_CONFIG(host));
@ -1164,27 +1163,24 @@ static int au1xmmc_suspend(struct platform_device *pdev, pm_message_t state)
return 0; return 0;
} }
static int au1xmmc_resume(struct platform_device *pdev) static int au1xmmc_resume(struct device *dev)
{ {
struct au1xmmc_host *host = platform_get_drvdata(pdev); struct au1xmmc_host *host = dev_get_drvdata(dev);
au1xmmc_reset_controller(host); au1xmmc_reset_controller(host);
return 0; return 0;
} }
#else
#define au1xmmc_suspend NULL static DEFINE_SIMPLE_DEV_PM_OPS(au1xmmc_pmops, au1xmmc_suspend, au1xmmc_resume);
#define au1xmmc_resume NULL
#endif
static struct platform_driver au1xmmc_driver = { static struct platform_driver au1xmmc_driver = {
.probe = au1xmmc_probe, .probe = au1xmmc_probe,
.remove = au1xmmc_remove, .remove = au1xmmc_remove,
.suspend = au1xmmc_suspend,
.resume = au1xmmc_resume,
.driver = { .driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS, .probe_type = PROBE_PREFER_ASYNCHRONOUS,
.pm = pm_sleep_ptr(&au1xmmc_pmops),
}, },
}; };