mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 05:44:11 +00:00
mtd: st_spi_fsm: Use the devm_clk_get_enabled() helper function
Use the devm_clk_get_enabled() helper function instead of hand-writing it. It saves some line of codes. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/4025ec3980a956b0e776024e88ec960afc457501.1681636580.git.christophe.jaillet@wanadoo.fr
This commit is contained in:
parent
ac9a78681b
commit
a2c2690f0d
1 changed files with 6 additions and 22 deletions
|
@ -2046,34 +2046,26 @@ static int stfsm_probe(struct platform_device *pdev)
|
|||
return PTR_ERR(fsm->base);
|
||||
}
|
||||
|
||||
fsm->clk = devm_clk_get(&pdev->dev, NULL);
|
||||
fsm->clk = devm_clk_get_enabled(&pdev->dev, NULL);
|
||||
if (IS_ERR(fsm->clk)) {
|
||||
dev_err(fsm->dev, "Couldn't find EMI clock.\n");
|
||||
return PTR_ERR(fsm->clk);
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(fsm->clk);
|
||||
if (ret) {
|
||||
dev_err(fsm->dev, "Failed to enable EMI clock.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
mutex_init(&fsm->lock);
|
||||
|
||||
ret = stfsm_init(fsm);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed to initialise FSM Controller\n");
|
||||
goto err_clk_unprepare;
|
||||
return ret;
|
||||
}
|
||||
|
||||
stfsm_fetch_platform_configs(pdev);
|
||||
|
||||
/* Detect SPI FLASH device */
|
||||
info = stfsm_jedec_probe(fsm);
|
||||
if (!info) {
|
||||
ret = -ENODEV;
|
||||
goto err_clk_unprepare;
|
||||
}
|
||||
if (!info)
|
||||
return -ENODEV;
|
||||
fsm->info = info;
|
||||
|
||||
/* Use device size to determine address width */
|
||||
|
@ -2089,7 +2081,7 @@ static int stfsm_probe(struct platform_device *pdev)
|
|||
else
|
||||
ret = stfsm_prepare_rwe_seqs_default(fsm);
|
||||
if (ret)
|
||||
goto err_clk_unprepare;
|
||||
return ret;
|
||||
|
||||
fsm->mtd.name = info->name;
|
||||
fsm->mtd.dev.parent = &pdev->dev;
|
||||
|
@ -2112,13 +2104,7 @@ static int stfsm_probe(struct platform_device *pdev)
|
|||
(long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20),
|
||||
fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10));
|
||||
|
||||
ret = mtd_device_register(&fsm->mtd, NULL, 0);
|
||||
if (ret) {
|
||||
err_clk_unprepare:
|
||||
clk_disable_unprepare(fsm->clk);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return mtd_device_register(&fsm->mtd, NULL, 0);
|
||||
}
|
||||
|
||||
static int stfsm_remove(struct platform_device *pdev)
|
||||
|
@ -2127,8 +2113,6 @@ static int stfsm_remove(struct platform_device *pdev)
|
|||
|
||||
WARN_ON(mtd_device_unregister(&fsm->mtd));
|
||||
|
||||
clk_disable_unprepare(fsm->clk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue