[PATCH 28/39] spi: rockchip: use modern PM macros
Jisheng Zhang <[email protected]> Mon, 3 Aug 2026 22:19:52 +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. 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-rockchip.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 231fbcf0e7aa..1a81fd94b439 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -938,7 +938,6 @@ static void rockchip_spi_remove(struct platform_device *pdev) dma_release_channel(ctlr->dma_rx); } -#ifdef CONFIG_PM_SLEEP static int rockchip_spi_suspend(struct device *dev) { int ret; @@ -972,9 +971,7 @@ static int rockchip_spi_resume(struct device *dev) return spi_controller_resume(ctlr); } -#endif /* CONFIG_PM_SLEEP */ -#ifdef CONFIG_PM static int rockchip_spi_runtime_suspend(struct device *dev) { struct spi_controller *ctlr = dev_get_drvdata(dev); @@ -1002,12 +999,11 @@ static int rockchip_spi_runtime_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM */ static const struct dev_pm_ops rockchip_spi_pm = { - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(rockchip_spi_suspend, rockchip_spi_resume) - SET_RUNTIME_PM_OPS(rockchip_spi_runtime_suspend, - rockchip_spi_runtime_resume, NULL) + NOIRQ_SYSTEM_SLEEP_PM_OPS(rockchip_spi_suspend, rockchip_spi_resume) + RUNTIME_PM_OPS(rockchip_spi_runtime_suspend, + rockchip_spi_runtime_resume, NULL) }; static const struct of_device_id rockchip_spi_dt_match[] = { @@ -1030,7 +1026,7 @@ MODULE_DEVICE_TABLE(of, rockchip_spi_dt_match); static struct platform_driver rockchip_spi_driver = { .driver = { .name = DRIVER_NAME, - .pm = &rockchip_spi_pm, + .pm = pm_ptr(&rockchip_spi_pm), .of_match_table = of_match_ptr(rockchip_spi_dt_match), }, .probe = rockchip_spi_probe, -- 2.53.0