spi: dln2: 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://patch.msgid.link/20260803142003.12857-11-jszhang@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Jisheng Zhang 2026-08-03 22:19:34 +08:00 committed by Mark Brown
parent 7975bfcf50
commit a0b764e3ec
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -787,7 +787,6 @@ static void dln2_spi_remove(struct platform_device *pdev)
dev_err(&pdev->dev, "Failed to disable SPI module\n");
}
#ifdef CONFIG_PM_SLEEP
static int dln2_spi_suspend(struct device *dev)
{
int ret;
@ -834,9 +833,7 @@ static int dln2_spi_resume(struct device *dev)
return spi_controller_resume(host);
}
#endif /* CONFIG_PM_SLEEP */
#ifdef CONFIG_PM
static int dln2_spi_runtime_suspend(struct device *dev)
{
struct spi_controller *host = dev_get_drvdata(dev);
@ -852,18 +849,16 @@ static int dln2_spi_runtime_resume(struct device *dev)
return dln2_spi_enable(dln2, true);
}
#endif /* CONFIG_PM */
static const struct dev_pm_ops dln2_spi_pm = {
SET_SYSTEM_SLEEP_PM_OPS(dln2_spi_suspend, dln2_spi_resume)
SET_RUNTIME_PM_OPS(dln2_spi_runtime_suspend,
dln2_spi_runtime_resume, NULL)
SYSTEM_SLEEP_PM_OPS(dln2_spi_suspend, dln2_spi_resume)
RUNTIME_PM_OPS(dln2_spi_runtime_suspend, dln2_spi_runtime_resume, NULL)
};
static struct platform_driver spi_dln2_driver = {
.driver = {
.name = "dln2-spi",
.pm = &dln2_spi_pm,
.pm = pm_ptr(&dln2_spi_pm),
},
.probe = dln2_spi_probe,
.remove = dln2_spi_remove,