Skip to content

Commit 000412e

Browse files
Li Zetaomiquelraynal
authored andcommitted
mtd: spear_smi: 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 "err_irq". 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-2-lizetao1@huawei.com
1 parent f7091fb commit 000412e

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

drivers/mtd/devices/spear_smi.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -993,21 +993,17 @@ static int spear_smi_probe(struct platform_device *pdev)
993993
dev->num_flashes = MAX_NUM_FLASH_CHIP;
994994
}
995995

996-
dev->clk = devm_clk_get(&pdev->dev, NULL);
996+
dev->clk = devm_clk_get_enabled(&pdev->dev, NULL);
997997
if (IS_ERR(dev->clk)) {
998998
ret = PTR_ERR(dev->clk);
999999
goto err;
10001000
}
10011001

1002-
ret = clk_prepare_enable(dev->clk);
1003-
if (ret)
1004-
goto err;
1005-
10061002
ret = devm_request_irq(&pdev->dev, irq, spear_smi_int_handler, 0,
10071003
pdev->name, dev);
10081004
if (ret) {
10091005
dev_err(&dev->pdev->dev, "SMI IRQ allocation failed\n");
1010-
goto err_irq;
1006+
goto err;
10111007
}
10121008

10131009
mutex_init(&dev->lock);
@@ -1020,14 +1016,11 @@ static int spear_smi_probe(struct platform_device *pdev)
10201016
ret = spear_smi_setup_banks(pdev, i, pdata->np[i]);
10211017
if (ret) {
10221018
dev_err(&dev->pdev->dev, "bank setup failed\n");
1023-
goto err_irq;
1019+
goto err;
10241020
}
10251021
}
10261022

10271023
return 0;
1028-
1029-
err_irq:
1030-
clk_disable_unprepare(dev->clk);
10311024
err:
10321025
return ret;
10331026
}
@@ -1056,8 +1049,6 @@ static int spear_smi_remove(struct platform_device *pdev)
10561049
WARN_ON(mtd_device_unregister(&flash->mtd));
10571050
}
10581051

1059-
clk_disable_unprepare(dev->clk);
1060-
10611052
return 0;
10621053
}
10631054

0 commit comments

Comments
 (0)