[PATCH 05/17] spi: imx: Use helper function devm_clk_get_enabled()

Pei Xiao
2026-03-12T23:08:56Z

drivers/spi/spi-imx.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 64c6c09e1e7b..a01c466818de 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -2323,26 +2323,18 @@ static int spi_imx_probe(struct platform_device *pdev)
goto out_controller_put;
}

- spi_imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
+ spi_imx->clk_ipg = devm_clk_get_enabled(&pdev->dev, "ipg");
if (IS_ERR(spi_imx->clk_ipg)) {
ret = PTR_ERR(spi_imx->clk_ipg);
goto out_controller_put;
}

- spi_imx->clk_per = devm_clk_get(&pdev->dev, "per");
+ spi_imx->clk_per = devm_clk_get_enabled(&pdev->dev, "per");
if (IS_ERR(spi_imx->clk_per)) {
ret = PTR_ERR(spi_imx->clk_per);
goto out_controller_put;
}

- ret = clk_prepare_enable(spi_imx->clk_per);
- if (ret)
- goto out_controller_put;
-
- ret = clk_prepare_enable(spi_imx->clk_ipg);
- if (ret)
- goto out_put_per;
-
pm_runtime_set_autosuspend_delay(spi_imx->dev, MXC_RPM_TIMEOUT);
pm_runtime_use_autosuspend(spi_imx->dev);
pm_runtime_get_noresume(spi_imx->dev);
@@ -2386,9 +2378,6 @@ static int spi_imx_probe(struct platform_device *pdev)
pm_runtime_disable(spi_imx->dev);
pm_runtime_set_suspended(&pdev->dev);

- clk_disable_unprepare(spi_imx->clk_ipg);
-out_put_per:
- clk_disable_unprepare(spi_imx->clk_per);
out_controller_put:
spi_controller_put(controller);

--
2.25.1