Skip to content

Commit a36201a

Browse files
Li Zetaomiquelraynal
authored andcommitted
mtd: rawnand: arasan: 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 "disable_bus_clk" and "disable_controller_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-3-lizetao1@huawei.com
1 parent a82990c commit a36201a

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

drivers/mtd/nand/raw/arasan-nand-controller.c

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,55 +1440,36 @@ static int anfc_probe(struct platform_device *pdev)
14401440

14411441
anfc_reset(nfc);
14421442

1443-
nfc->controller_clk = devm_clk_get(&pdev->dev, "controller");
1443+
nfc->controller_clk = devm_clk_get_enabled(&pdev->dev, "controller");
14441444
if (IS_ERR(nfc->controller_clk))
14451445
return PTR_ERR(nfc->controller_clk);
14461446

1447-
nfc->bus_clk = devm_clk_get(&pdev->dev, "bus");
1447+
nfc->bus_clk = devm_clk_get_enabled(&pdev->dev, "bus");
14481448
if (IS_ERR(nfc->bus_clk))
14491449
return PTR_ERR(nfc->bus_clk);
14501450

1451-
ret = clk_prepare_enable(nfc->controller_clk);
1452-
if (ret)
1453-
return ret;
1454-
1455-
ret = clk_prepare_enable(nfc->bus_clk);
1456-
if (ret)
1457-
goto disable_controller_clk;
1458-
14591451
ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
14601452
if (ret)
1461-
goto disable_bus_clk;
1453+
return ret;
14621454

14631455
ret = anfc_parse_cs(nfc);
14641456
if (ret)
1465-
goto disable_bus_clk;
1457+
return ret;
14661458

14671459
ret = anfc_chips_init(nfc);
14681460
if (ret)
1469-
goto disable_bus_clk;
1461+
return ret;
14701462

14711463
platform_set_drvdata(pdev, nfc);
14721464

14731465
return 0;
1474-
1475-
disable_bus_clk:
1476-
clk_disable_unprepare(nfc->bus_clk);
1477-
1478-
disable_controller_clk:
1479-
clk_disable_unprepare(nfc->controller_clk);
1480-
1481-
return ret;
14821466
}
14831467

14841468
static void anfc_remove(struct platform_device *pdev)
14851469
{
14861470
struct arasan_nfc *nfc = platform_get_drvdata(pdev);
14871471

14881472
anfc_chips_cleanup(nfc);
1489-
1490-
clk_disable_unprepare(nfc->bus_clk);
1491-
clk_disable_unprepare(nfc->controller_clk);
14921473
}
14931474

14941475
static const struct of_device_id anfc_ids[] = {

0 commit comments

Comments
 (0)