mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 15:03:52 +08:00
mmc: sh_mmicf: Use devm_mmc_alloc_host() helper
Use new function devm_mmc_alloc_host() to simplify the code. Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Link: https://lore.kernel.org/r/af6b34130eb98cb60aa7c5f289e2392089faae66.1748933789.git.zhoubinbin@loongson.cn Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
@@ -1444,13 +1444,13 @@ static int sh_mmcif_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(reg))
|
||||
return PTR_ERR(reg);
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct sh_mmcif_host), dev);
|
||||
mmc = devm_mmc_alloc_host(dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = mmc_of_parse(mmc);
|
||||
if (ret < 0)
|
||||
goto err_host;
|
||||
return ret;
|
||||
|
||||
host = mmc_priv(mmc);
|
||||
host->mmc = mmc;
|
||||
@@ -1481,15 +1481,13 @@ static int sh_mmcif_probe(struct platform_device *pdev)
|
||||
platform_set_drvdata(pdev, host);
|
||||
|
||||
host->clk = devm_clk_get(dev, NULL);
|
||||
if (IS_ERR(host->clk)) {
|
||||
ret = PTR_ERR(host->clk);
|
||||
dev_err(dev, "cannot get clock: %d\n", ret);
|
||||
goto err_host;
|
||||
}
|
||||
if (IS_ERR(host->clk))
|
||||
return dev_err_probe(dev, PTR_ERR(host->clk),
|
||||
"cannot get clock\n");
|
||||
|
||||
ret = clk_prepare_enable(host->clk);
|
||||
if (ret < 0)
|
||||
goto err_host;
|
||||
return ret;
|
||||
|
||||
sh_mmcif_clk_setup(host);
|
||||
|
||||
@@ -1542,8 +1540,6 @@ err_clk:
|
||||
clk_disable_unprepare(host->clk);
|
||||
pm_runtime_put_sync(dev);
|
||||
pm_runtime_disable(dev);
|
||||
err_host:
|
||||
mmc_free_host(mmc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1568,7 +1564,6 @@ static void sh_mmcif_remove(struct platform_device *pdev)
|
||||
cancel_delayed_work_sync(&host->timeout_work);
|
||||
|
||||
clk_disable_unprepare(host->clk);
|
||||
mmc_free_host(host->mmc);
|
||||
pm_runtime_put_sync(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user