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 <jszhang@kernel.org>
Link: https://patch.msgid.link/20260803142003.12857-13-jszhang@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Jisheng Zhang 2026-08-03 22:19:36 +08:00 committed by Mark Brown
parent 65172b5d38
commit cda6ef242a
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -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,