Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: rawnand: mpc5121: Use helper function devm_clk_get_enabled()

Since commit 7ef9651e9792 ("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

authored by

Li Zetao and committed by
Miquel Raynal
008b239f 7714579d

+2 -9
+2 -9
drivers/mtd/nand/raw/mpc5121_nfc.c
··· 595 595 struct nand_chip *chip = mtd_to_nand(mtd); 596 596 struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip); 597 597 598 - clk_disable_unprepare(prv->clk); 599 - 600 598 if (prv->csreg) 601 599 iounmap(prv->csreg); 602 600 } ··· 715 717 } 716 718 717 719 /* Enable NFC clock */ 718 - clk = devm_clk_get(dev, "ipg"); 720 + clk = devm_clk_get_enabled(dev, "ipg"); 719 721 if (IS_ERR(clk)) { 720 - dev_err(dev, "Unable to acquire NFC clock!\n"); 722 + dev_err(dev, "Unable to acquire and enable NFC clock!\n"); 721 723 retval = PTR_ERR(clk); 722 - goto error; 723 - } 724 - retval = clk_prepare_enable(clk); 725 - if (retval) { 726 - dev_err(dev, "Unable to enable NFC clock!\n"); 727 724 goto error; 728 725 } 729 726 prv->clk = clk;