[PATCH 17/17] spi: zynqmp-gqspi: Use helper function devm_clk_get_enabled()

Pei Xiao
2026-03-12T23:06:48Z

drivers/spi/spi-zynqmp-gqspi.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c
index 502fd5eccc83..a88b07956c33 100644
--- a/drivers/spi/spi-zynqmp-gqspi.c
+++ b/drivers/spi/spi-zynqmp-gqspi.c
@@ -1244,26 +1244,16 @@ static int zynqmp_qspi_probe(struct platform_device *pdev)
if (IS_ERR(xqspi->regs))
return PTR_ERR(xqspi->regs);

- xqspi->pclk = devm_clk_get(&pdev->dev, "pclk");
+ xqspi->pclk = devm_clk_get_enabled(&pdev->dev, "pclk");
if (IS_ERR(xqspi->pclk))
return dev_err_probe(dev, PTR_ERR(xqspi->pclk),
"pclk clock not found.\n");

- xqspi->refclk = devm_clk_get(&pdev->dev, "ref_clk");
+ xqspi->refclk = devm_clk_get_enabled(&pdev->dev, "ref_clk");
if (IS_ERR(xqspi->refclk))
return dev_err_probe(dev, PTR_ERR(xqspi->refclk),
"ref_clk clock not found.\n");

- ret = clk_prepare_enable(xqspi->pclk);
- if (ret)
- return dev_err_probe(dev, ret, "Unable to enable APB clock.\n");
-
- ret = clk_prepare_enable(xqspi->refclk);
- if (ret) {
- dev_err(dev, "Unable to enable device clock.\n");
- goto clk_dis_pclk;
- }
-
init_completion(&xqspi->data_completion);

mutex_init(&xqspi->op_lock);
@@ -1339,9 +1329,6 @@ static int zynqmp_qspi_probe(struct platform_device *pdev)
pm_runtime_dont_use_autosuspend(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
- clk_disable_unprepare(xqspi->refclk);
-clk_dis_pclk:
- clk_disable_unprepare(xqspi->pclk);

return ret;
}
--
2.25.1