[PATCH v2 1/3] spi: nxp-fspi: use devm runtime PM enablement

From: Jiawen Liu

Date: Tue Jul 28 2026 - 04:11:26 EST


nxp_fspi_probe() enables runtime PM and then gets the device active for
the initial register setup. If that get fails, the old open-coded
pm_runtime_get_sync() path needs manual cleanup of both the usage counter
and runtime PM enablement.

Follow the newer spi-nxp-xspi pattern instead: use
devm_pm_runtime_enable() for managed runtime PM disablement, and use
PM_RUNTIME_ACQUIRE_AUTOSUSPEND() for the initial active window. This keeps
the error path simple and avoids leaving runtime PM state behind when the
initial resume fails.

Signed-off-by: Jiawen Liu <1298662399@xxxxxx>
---
drivers/spi/spi-nxp-fspi.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index 1e36ae084dd8..6be78712b534 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -1275,7 +1275,6 @@ static void nxp_fspi_cleanup(void *data)
/* disable the hardware */
fspi_writel(f, FSPI_MCR0_MDIS, f->iobase + FSPI_MCR0);

- pm_runtime_disable(f->dev);
pm_runtime_put_noidle(f->dev);
nxp_fspi_clk_disable_unprep(f);

@@ -1345,12 +1344,15 @@ static int nxp_fspi_probe(struct platform_device *pdev)
if (irq < 0)
return dev_err_probe(dev, irq, "Failed to get irq source");

- pm_runtime_enable(dev);
pm_runtime_set_autosuspend_delay(dev, FSPI_RPM_TIMEOUT);
pm_runtime_use_autosuspend(dev);
+ ret = devm_pm_runtime_enable(dev);
+ if (ret)
+ return ret;

/* enable clock */
- ret = pm_runtime_get_sync(f->dev);
+ PM_RUNTIME_ACQUIRE_AUTOSUSPEND(dev, pm);
+ ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
if (ret < 0)
return dev_err_probe(dev, ret, "Failed to enable clock");

@@ -1361,10 +1363,6 @@ static int nxp_fspi_probe(struct platform_device *pdev)

nxp_fspi_default_setup(f);

- ret = pm_runtime_put_sync(dev);
- if (ret < 0)
- return dev_err_probe(dev, ret, "Failed to disable clock");
-
init_completion(&f->c);
ret = devm_request_irq(dev, irq,
nxp_fspi_irq_handler, 0, pdev->name, f);
--
2.34.1