Skip to content

Commit 7714579

Browse files
Li Zetaomiquelraynal
authored andcommitted
mtd: rawnand: lpc32xx_slc: 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 "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-6-lizetao1@huawei.com
1 parent 03f2cde commit 7714579

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

drivers/mtd/nand/raw/lpc32xx_slc.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -871,15 +871,12 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
871871
mtd->dev.parent = &pdev->dev;
872872

873873
/* Get NAND clock */
874-
host->clk = devm_clk_get(&pdev->dev, NULL);
874+
host->clk = devm_clk_get_enabled(&pdev->dev, NULL);
875875
if (IS_ERR(host->clk)) {
876876
dev_err(&pdev->dev, "Clock failure\n");
877877
res = -ENOENT;
878878
goto enable_wp;
879879
}
880-
res = clk_prepare_enable(host->clk);
881-
if (res)
882-
goto enable_wp;
883880

884881
/* Set NAND IO addresses and command/ready functions */
885882
chip->legacy.IO_ADDR_R = SLC_DATA(host->io_base);
@@ -907,13 +904,13 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
907904
GFP_KERNEL);
908905
if (host->data_buf == NULL) {
909906
res = -ENOMEM;
910-
goto unprepare_clk;
907+
goto enable_wp;
911908
}
912909

913910
res = lpc32xx_nand_dma_setup(host);
914911
if (res) {
915912
res = -EIO;
916-
goto unprepare_clk;
913+
goto enable_wp;
917914
}
918915

919916
/* Find NAND device */
@@ -934,8 +931,6 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
934931
nand_cleanup(chip);
935932
release_dma:
936933
dma_release_channel(host->dma_chan);
937-
unprepare_clk:
938-
clk_disable_unprepare(host->clk);
939934
enable_wp:
940935
lpc32xx_wp_enable(host);
941936

@@ -962,7 +957,6 @@ static void lpc32xx_nand_remove(struct platform_device *pdev)
962957
tmp &= ~SLCCFG_CE_LOW;
963958
writel(tmp, SLC_CTRL(host->io_base));
964959

965-
clk_disable_unprepare(host->clk);
966960
lpc32xx_wp_enable(host);
967961
}
968962

0 commit comments

Comments
 (0)