summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/raw/orion_nand.c
diff options
context:
space:
mode:
authorLi Zetao <lizetao1@huawei.com>2023-08-21 05:17:37 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2023-08-21 09:44:23 +0200
commit2c11ea7bee3126f89d0e1b6fec0956b20017ce83 (patch)
tree176484a350574d583c84ee1a4d692be7903151d5 /drivers/mtd/nand/raw/orion_nand.c
parentmtd: rawnand: vf610_nfc: Use helper function devm_clk_get_enabled() (diff)
downloadlinux-2c11ea7bee3126f89d0e1b6fec0956b20017ce83.tar.xz
linux-2c11ea7bee3126f89d0e1b6fec0956b20017ce83.zip
mtd: rawnand: orion: Use helper function devm_clk_get_optional_enabled()
Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get_optional() and clk_prepare_enable() can now be replaced by devm_clk_get_optional_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 "no_dev". 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-13-lizetao1@huawei.com
Diffstat (limited to 'drivers/mtd/nand/raw/orion_nand.c')
-rw-r--r--drivers/mtd/nand/raw/orion_nand.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/drivers/mtd/nand/raw/orion_nand.c b/drivers/mtd/nand/raw/orion_nand.c
index 7e0313889b50..2951d81614fd 100644
--- a/drivers/mtd/nand/raw/orion_nand.c
+++ b/drivers/mtd/nand/raw/orion_nand.c
@@ -169,16 +169,10 @@ static int __init orion_nand_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, info);
/* Not all platforms can gate the clock, so it is optional. */
- info->clk = devm_clk_get_optional(&pdev->dev, NULL);
+ info->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
if (IS_ERR(info->clk))
return dev_err_probe(&pdev->dev, PTR_ERR(info->clk),
- "failed to get clock!\n");
-
- ret = clk_prepare_enable(info->clk);
- if (ret) {
- dev_err(&pdev->dev, "failed to prepare clock!\n");
- return ret;
- }
+ "failed to get and enable clock!\n");
/*
* This driver assumes that the default ECC engine should be TYPE_SOFT.
@@ -189,19 +183,13 @@ static int __init orion_nand_probe(struct platform_device *pdev)
ret = nand_scan(nc, 1);
if (ret)
- goto no_dev;
+ return ret;
mtd->name = "orion_nand";
ret = mtd_device_register(mtd, board->parts, board->nr_parts);
- if (ret) {
+ if (ret)
nand_cleanup(nc);
- goto no_dev;
- }
-
- return 0;
-no_dev:
- clk_disable_unprepare(info->clk);
return ret;
}
@@ -215,8 +203,6 @@ static void orion_nand_remove(struct platform_device *pdev)
WARN_ON(ret);
nand_cleanup(chip);
-
- clk_disable_unprepare(info->clk);
}
#ifdef CONFIG_OF