summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorLi Zetao <lizetao1@huawei.com>2023-08-23 21:39:34 +0800
committerMark Brown <broonie@kernel.org>2023-09-11 01:32:09 +0100
commitbbd0a66b85fe860e8b6acfb1739d15b517a4f6fb (patch)
treee567e04806ef8ce5205c94aa6c4d3fa1fe240fa4 /drivers/spi
parent82c4fadb0b957c817b5a3fcc05dc774bf32a4d07 (diff)
spi: orion: Use helper function devm_clk_get_enabled()
Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Li Zetao <lizetao1@huawei.com> Link: https://lore.kernel.org/r/20230823133938.1359106-22-lizetao1@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-orion.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
index 1f10f5c8e34d..eee9ff4bfa5b 100644
--- a/drivers/spi/spi-orion.c
+++ b/drivers/spi/spi-orion.c
@@ -688,21 +688,17 @@ static int orion_spi_probe(struct platform_device *pdev)
devdata = devdata ? devdata : &orion_spi_dev_data;
spi->devdata = devdata;
- spi->clk = devm_clk_get(&pdev->dev, NULL);
+ spi->clk = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(spi->clk)) {
status = PTR_ERR(spi->clk);
goto out;
}
- status = clk_prepare_enable(spi->clk);
- if (status)
- goto out;
-
/* The following clock is only used by some SoCs */
spi->axi_clk = devm_clk_get(&pdev->dev, "axi");
if (PTR_ERR(spi->axi_clk) == -EPROBE_DEFER) {
status = -EPROBE_DEFER;
- goto out_rel_clk;
+ goto out;
}
if (!IS_ERR(spi->axi_clk))
clk_prepare_enable(spi->axi_clk);
@@ -795,8 +791,6 @@ out_rel_pm:
pm_runtime_disable(&pdev->dev);
out_rel_axi_clk:
clk_disable_unprepare(spi->axi_clk);
-out_rel_clk:
- clk_disable_unprepare(spi->clk);
out:
spi_controller_put(host);
return status;
@@ -810,7 +804,6 @@ static void orion_spi_remove(struct platform_device *pdev)
pm_runtime_get_sync(&pdev->dev);
clk_disable_unprepare(spi->axi_clk);
- clk_disable_unprepare(spi->clk);
spi_unregister_controller(host);
pm_runtime_disable(&pdev->dev);