[PATCH 32/39] spi: sunplus-sp7021: use modern PM macros
Jisheng Zhang <[email protected]> Mon, 3 Aug 2026 22:19:56 +0800
| Newsgroups | org.kernel.vger.linux-spi,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- drivers/spi/spi-sunplus-sp7021.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/spi/spi-sunplus-sp7021.c b/drivers/spi/spi-sunplus-sp7021.c index c1870322d976..f16fcda187dd 100644 --- a/drivers/spi/spi-sunplus-sp7021.c +++ b/drivers/spi/spi-sunplus-sp7021.c @@ -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); -- 2.53.0