spi: sunplus-sp7021: 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 or
__maybe_unused.

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-33-jszhang@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Jisheng Zhang 2026-08-03 22:19:56 +08:00 committed by Mark Brown
parent 96e9434dee
commit 3c71dabf59
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -498,7 +498,7 @@ static void sp7021_spi_controller_remove(struct platform_device *pdev)
pm_runtime_set_suspended(&pdev->dev);
}
static int __maybe_unused sp7021_spi_controller_suspend(struct device *dev)
static int sp7021_spi_controller_suspend(struct device *dev)
{
struct spi_controller *ctlr = dev_get_drvdata(dev);
struct sp7021_spi_ctlr *pspim = spi_controller_get_devdata(ctlr);
@ -506,7 +506,7 @@ static int __maybe_unused sp7021_spi_controller_suspend(struct device *dev)
return reset_control_assert(pspim->rstc);
}
static int __maybe_unused sp7021_spi_controller_resume(struct device *dev)
static int sp7021_spi_controller_resume(struct device *dev)
{
struct spi_controller *ctlr = dev_get_drvdata(dev);
struct sp7021_spi_ctlr *pspim = spi_controller_get_devdata(ctlr);
@ -515,7 +515,6 @@ static int __maybe_unused sp7021_spi_controller_resume(struct device *dev)
return clk_prepare_enable(pspim->spi_clk);
}
#ifdef CONFIG_PM
static int sp7021_spi_runtime_suspend(struct device *dev)
{
struct spi_controller *ctlr = dev_get_drvdata(dev);
@ -531,13 +530,12 @@ static int sp7021_spi_runtime_resume(struct device *dev)
return reset_control_deassert(pspim->rstc);
}
#endif
static const struct dev_pm_ops sp7021_spi_pm_ops = {
SET_RUNTIME_PM_OPS(sp7021_spi_runtime_suspend,
sp7021_spi_runtime_resume, NULL)
SET_SYSTEM_SLEEP_PM_OPS(sp7021_spi_controller_suspend,
sp7021_spi_controller_resume)
RUNTIME_PM_OPS(sp7021_spi_runtime_suspend,
sp7021_spi_runtime_resume, NULL)
SYSTEM_SLEEP_PM_OPS(sp7021_spi_controller_suspend,
sp7021_spi_controller_resume)
};
static const struct of_device_id sp7021_spi_controller_ids[] = {
@ -552,7 +550,7 @@ static struct platform_driver sp7021_spi_controller_driver = {
.driver = {
.name = "sunplus,sp7021-spi-controller",
.of_match_table = sp7021_spi_controller_ids,
.pm = &sp7021_spi_pm_ops,
.pm = pm_ptr(&sp7021_spi_pm_ops),
},
};
module_platform_driver(sp7021_spi_controller_driver);