Skip to content

Commit bbd0a66

Browse files
Li Zetaobroonie
authored andcommitted
spi: orion: Use helper function devm_clk_get_enabled()
Since commit 7ef9651 ("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 <[email protected]> Signed-off-by: Li Zetao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 82c4fad commit bbd0a66

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

drivers/spi/spi-orion.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -688,21 +688,17 @@ static int orion_spi_probe(struct platform_device *pdev)
688688
devdata = devdata ? devdata : &orion_spi_dev_data;
689689
spi->devdata = devdata;
690690

691-
spi->clk = devm_clk_get(&pdev->dev, NULL);
691+
spi->clk = devm_clk_get_enabled(&pdev->dev, NULL);
692692
if (IS_ERR(spi->clk)) {
693693
status = PTR_ERR(spi->clk);
694694
goto out;
695695
}
696696

697-
status = clk_prepare_enable(spi->clk);
698-
if (status)
699-
goto out;
700-
701697
/* The following clock is only used by some SoCs */
702698
spi->axi_clk = devm_clk_get(&pdev->dev, "axi");
703699
if (PTR_ERR(spi->axi_clk) == -EPROBE_DEFER) {
704700
status = -EPROBE_DEFER;
705-
goto out_rel_clk;
701+
goto out;
706702
}
707703
if (!IS_ERR(spi->axi_clk))
708704
clk_prepare_enable(spi->axi_clk);
@@ -795,8 +791,6 @@ static int orion_spi_probe(struct platform_device *pdev)
795791
pm_runtime_disable(&pdev->dev);
796792
out_rel_axi_clk:
797793
clk_disable_unprepare(spi->axi_clk);
798-
out_rel_clk:
799-
clk_disable_unprepare(spi->clk);
800794
out:
801795
spi_controller_put(host);
802796
return status;
@@ -810,7 +804,6 @@ static void orion_spi_remove(struct platform_device *pdev)
810804

811805
pm_runtime_get_sync(&pdev->dev);
812806
clk_disable_unprepare(spi->axi_clk);
813-
clk_disable_unprepare(spi->clk);
814807

815808
spi_unregister_controller(host);
816809
pm_runtime_disable(&pdev->dev);

0 commit comments

Comments
 (0)