Skip to content

Commit ee0152d

Browse files
Li Zetaomiquelraynal
authored andcommitted
mtd: rawnand: fsmc: 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. The label "disable_clk" no longer makes sense, rename it to "disable_fsmc". 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-4-lizetao1@huawei.com
1 parent a36201a commit ee0152d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

drivers/mtd/nand/raw/fsmc_nand.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,16 +1066,12 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
10661066
host->regs_va = base + FSMC_NOR_REG_SIZE +
10671067
(host->bank * FSMC_NAND_BANK_SZ);
10681068

1069-
host->clk = devm_clk_get(&pdev->dev, NULL);
1069+
host->clk = devm_clk_get_enabled(&pdev->dev, NULL);
10701070
if (IS_ERR(host->clk)) {
10711071
dev_err(&pdev->dev, "failed to fetch block clock\n");
10721072
return PTR_ERR(host->clk);
10731073
}
10741074

1075-
ret = clk_prepare_enable(host->clk);
1076-
if (ret)
1077-
return ret;
1078-
10791075
/*
10801076
* This device ID is actually a common AMBA ID as used on the
10811077
* AMBA PrimeCell bus. However it is not a PrimeCell.
@@ -1111,7 +1107,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
11111107
if (!host->read_dma_chan) {
11121108
dev_err(&pdev->dev, "Unable to get read dma channel\n");
11131109
ret = -ENODEV;
1114-
goto disable_clk;
1110+
goto disable_fsmc;
11151111
}
11161112
host->write_dma_chan = dma_request_channel(mask, filter, NULL);
11171113
if (!host->write_dma_chan) {
@@ -1155,9 +1151,8 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
11551151
release_dma_read_chan:
11561152
if (host->mode == USE_DMA_ACCESS)
11571153
dma_release_channel(host->read_dma_chan);
1158-
disable_clk:
1154+
disable_fsmc:
11591155
fsmc_nand_disable(host);
1160-
clk_disable_unprepare(host->clk);
11611156

11621157
return ret;
11631158
}
@@ -1182,7 +1177,6 @@ static void fsmc_nand_remove(struct platform_device *pdev)
11821177
dma_release_channel(host->write_dma_chan);
11831178
dma_release_channel(host->read_dma_chan);
11841179
}
1185-
clk_disable_unprepare(host->clk);
11861180
}
11871181
}
11881182

0 commit comments

Comments
 (0)