[PATCH 01/17] spi: axiado: Use helper function devm_clk_get_enabled()

Pei Xiao
2026-03-12T23:11:17Z

drivers/spi/spi-axiado.c | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/spi/spi-axiado.c b/drivers/spi/spi-axiado.c
index 8cea81432c5b..4ba8f0e6909f 100644
--- a/drivers/spi/spi-axiado.c
+++ b/drivers/spi/spi-axiado.c
@@ -770,32 +770,20 @@ static int ax_spi_probe(struct platform_device *pdev)
goto remove_ctlr;
}

- xspi->pclk = devm_clk_get(&pdev->dev, "pclk");
+ xspi->pclk = devm_clk_get_enabled(&pdev->dev, "pclk");
if (IS_ERR(xspi->pclk)) {
- dev_err(&pdev->dev, "pclk clock not found.\n");
+ dev_err(&pdev->dev, "Unable to enable APB clock.\n");
ret = PTR_ERR(xspi->pclk);
goto remove_ctlr;
}

- xspi->ref_clk = devm_clk_get(&pdev->dev, "ref");
+ xspi->ref_clk = devm_clk_get_enabled(&pdev->dev, "ref");
if (IS_ERR(xspi->ref_clk)) {
- dev_err(&pdev->dev, "ref clock not found.\n");
+ dev_err(&pdev->dev, "Unable to enable device clock.\n");
ret = PTR_ERR(xspi->ref_clk);
goto remove_ctlr;
}

- ret = clk_prepare_enable(xspi->pclk);
- if (ret) {
- dev_err(&pdev->dev, "Unable to enable APB clock.\n");
- goto remove_ctlr;
- }
-
- ret = clk_prepare_enable(xspi->ref_clk);
- if (ret) {
- dev_err(&pdev->dev, "Unable to enable device clock.\n");
- goto clk_dis_apb;
- }
-
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
pm_runtime_get_noresume(&pdev->dev);
@@ -866,9 +854,6 @@ static int ax_spi_probe(struct platform_device *pdev)
clk_dis_all:
pm_runtime_set_suspended(&pdev->dev);
pm_runtime_disable(&pdev->dev);
- clk_disable_unprepare(xspi->ref_clk);
-clk_dis_apb:
- clk_disable_unprepare(xspi->pclk);
remove_ctlr:
spi_controller_put(ctlr);
return ret;
--
2.25.1