Skip to content

Commit 03f2cde

Browse files
Li Zetaomiquelraynal
authored andcommitted
mtd: rawnand: intel: 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, so drop the label "err_disable_unprepare_clk". Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Li Zetao <lizetao1@huawei.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20230821031737.1973183-5-lizetao1@huawei.com
1 parent ee0152d commit 03f2cde

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

drivers/mtd/nand/raw/intel-nand-controller.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -626,24 +626,18 @@ static int ebu_nand_probe(struct platform_device *pdev)
626626
goto err_of_node_put;
627627
}
628628

629-
ebu_host->clk = devm_clk_get(dev, NULL);
629+
ebu_host->clk = devm_clk_get_enabled(dev, NULL);
630630
if (IS_ERR(ebu_host->clk)) {
631631
ret = dev_err_probe(dev, PTR_ERR(ebu_host->clk),
632-
"failed to get clock\n");
633-
goto err_of_node_put;
634-
}
635-
636-
ret = clk_prepare_enable(ebu_host->clk);
637-
if (ret) {
638-
dev_err(dev, "failed to enable clock: %d\n", ret);
632+
"failed to get and enable clock\n");
639633
goto err_of_node_put;
640634
}
641635

642636
ebu_host->dma_tx = dma_request_chan(dev, "tx");
643637
if (IS_ERR(ebu_host->dma_tx)) {
644638
ret = dev_err_probe(dev, PTR_ERR(ebu_host->dma_tx),
645639
"failed to request DMA tx chan!.\n");
646-
goto err_disable_unprepare_clk;
640+
goto err_of_node_put;
647641
}
648642

649643
ebu_host->dma_rx = dma_request_chan(dev, "rx");
@@ -698,8 +692,6 @@ static int ebu_nand_probe(struct platform_device *pdev)
698692
nand_cleanup(&ebu_host->chip);
699693
err_cleanup_dma:
700694
ebu_dma_cleanup(ebu_host);
701-
err_disable_unprepare_clk:
702-
clk_disable_unprepare(ebu_host->clk);
703695
err_of_node_put:
704696
of_node_put(chip_np);
705697

@@ -716,7 +708,6 @@ static void ebu_nand_remove(struct platform_device *pdev)
716708
nand_cleanup(&ebu_host->chip);
717709
ebu_nand_disable(&ebu_host->chip);
718710
ebu_dma_cleanup(ebu_host);
719-
clk_disable_unprepare(ebu_host->clk);
720711
}
721712

722713
static const struct of_device_id ebu_nand_match[] = {

0 commit comments

Comments
 (0)