[PATCH 12/39] spi: spi-fsl-dspi: use modern PM macros

From: Jisheng Zhang

Date: Mon Aug 03 2026 - 11:03:28 EST


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@xxxxxxxxxx>
---
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 019d05cdefe6..ef86267c1772 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);
@@ -1500,9 +1499,8 @@ static int dspi_resume(struct device *dev)

return 0;
}
-#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)
{
@@ -1727,7 +1725,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,
--
2.53.0