From cda6ef242a6f6776a86047130e5500ed66902a8a Mon Sep 17 00:00:00 2001 From: Jisheng Zhang Date: Mon, 3 Aug 2026 22:19:36 +0800 Subject: [PATCH] spi: spi-fsl-dspi: 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 Link: https://patch.msgid.link/20260803142003.12857-13-jszhang@kernel.org Signed-off-by: Mark Brown --- drivers/spi/spi-fsl-dspi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index c2d283876ef8..23e6bc5f202e 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -1460,7 +1460,6 @@ static int dspi_init(struct fsl_dspi *dspi) return 0; } -#ifdef CONFIG_PM_SLEEP static int dspi_suspend(struct device *dev) { struct fsl_dspi *dspi = dev_get_drvdata(dev); @@ -1515,9 +1514,8 @@ static int dspi_resume(struct device *dev) clk_disable_unprepare(dspi->clk); return ret; } -#endif /* CONFIG_PM_SLEEP */ -static SIMPLE_DEV_PM_OPS(dspi_pm, dspi_suspend, dspi_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(dspi_pm, dspi_suspend, dspi_resume); static int dspi_target_abort(struct spi_controller *host) { @@ -1742,7 +1740,7 @@ static void dspi_shutdown(struct platform_device *pdev) static struct platform_driver fsl_dspi_driver = { .driver.name = DRIVER_NAME, .driver.of_match_table = fsl_dspi_dt_ids, - .driver.pm = &dspi_pm, + .driver.pm = pm_sleep_ptr(&dspi_pm), .probe = dspi_probe, .remove = dspi_remove, .shutdown = dspi_shutdown,