Skip to content

Commit 008b239

Browse files
Li Zetaomiquelraynal
authored andcommitted
mtd: rawnand: mpc5121: 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: 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-7-lizetao1@huawei.com
1 parent 7714579 commit 008b239

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

drivers/mtd/nand/raw/mpc5121_nfc.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,6 @@ static void mpc5121_nfc_free(struct device *dev, struct mtd_info *mtd)
595595
struct nand_chip *chip = mtd_to_nand(mtd);
596596
struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
597597

598-
clk_disable_unprepare(prv->clk);
599-
600598
if (prv->csreg)
601599
iounmap(prv->csreg);
602600
}
@@ -717,17 +715,12 @@ static int mpc5121_nfc_probe(struct platform_device *op)
717715
}
718716

719717
/* Enable NFC clock */
720-
clk = devm_clk_get(dev, "ipg");
718+
clk = devm_clk_get_enabled(dev, "ipg");
721719
if (IS_ERR(clk)) {
722-
dev_err(dev, "Unable to acquire NFC clock!\n");
720+
dev_err(dev, "Unable to acquire and enable NFC clock!\n");
723721
retval = PTR_ERR(clk);
724722
goto error;
725723
}
726-
retval = clk_prepare_enable(clk);
727-
if (retval) {
728-
dev_err(dev, "Unable to enable NFC clock!\n");
729-
goto error;
730-
}
731724
prv->clk = clk;
732725

733726
/* Reset NAND Flash controller */

0 commit comments

Comments
 (0)