[PATCH 02/17] spi: bcm63xx-hsspi: Use helper function devm_clk_get_enabled()

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

drivers/spi/spi-bcm63xx-hsspi.c | 44 +++++++++------------------------
1 file changed, 12 insertions(+), 32 deletions(-)

diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c
index 612f8802e690..7449e582e8c8 100644
--- a/drivers/spi/spi-bcm63xx-hsspi.c
+++ b/drivers/spi/spi-bcm63xx-hsspi.c
@@ -758,8 +758,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
if (IS_ERR(regs))
return PTR_ERR(regs);

- clk = devm_clk_get(dev, "hsspi");
-
+ clk = devm_clk_get_enabled(dev, "hsspi");
if (IS_ERR(clk))
return PTR_ERR(clk);

@@ -767,41 +766,26 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
if (IS_ERR(reset))
return PTR_ERR(reset);

- ret = clk_prepare_enable(clk);
- if (ret)
- return ret;
-
ret = reset_control_reset(reset);
- if (ret) {
- dev_err(dev, "unable to reset device: %d\n", ret);
- goto out_disable_clk;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "unable to reset device: %d\n", ret);

rate = clk_get_rate(clk);
if (!rate) {
- pll_clk = devm_clk_get(dev, "pll");
-
- if (IS_ERR(pll_clk)) {
- ret = PTR_ERR(pll_clk);
- goto out_disable_clk;
- }
-
- ret = clk_prepare_enable(pll_clk);
- if (ret)
- goto out_disable_clk;
+ pll_clk = devm_clk_get_enabled(dev, "pll");
+ if (IS_ERR(pll_clk))
+ return dev_err_probe(dev, PTR_ERR(pll_clk), "failed
+ enable pll clk\n");

rate = clk_get_rate(pll_clk);
- if (!rate) {
- ret = -EINVAL;
- goto out_disable_pll_clk;
- }
+ if (!rate)
+ return dev_err_probe(dev, -EINVAL, "failed get pll
+ clk rate\n");
}

host = spi_alloc_host(&pdev->dev, sizeof(*bs));
- if (!host) {
- ret = -ENOMEM;
- goto out_disable_pll_clk;
- }
+ if (!host)
+ return dev_err_probe(dev, -ENOMEM, "no mem\n");

bs = spi_controller_get_devdata(host);
bs->pdev = pdev;
@@ -887,10 +871,6 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
out_put_host:
spi_controller_put(host);
-out_disable_pll_clk:
- clk_disable_unprepare(pll_clk);
-out_disable_clk:
- clk_disable_unprepare(clk);
return ret;
}

--
2.25.1