mmc: tmio: Use devm_mmc_alloc_host() helper
Use new function devm_mmc_alloc_host() to simplify the code. Cc: Wolfram Sang <wsa+renesas@sang-engineering.com> Cc: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Link: https://lore.kernel.org/r/d7d9120fc1ca2eb014cda4e481af5add05be0bf6.1748933789.git.zhoubinbin@loongson.cn Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
99e85793aa
commit
4c2fc69f28
4 changed files with 6 additions and 27 deletions
|
|
@ -1164,7 +1164,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
|
|||
|
||||
ret = renesas_sdhi_clk_enable(host);
|
||||
if (ret)
|
||||
goto efree;
|
||||
return ret;
|
||||
|
||||
rcfg.of_node = of_get_available_child_by_name(dev->of_node, "vqmmc-regulator");
|
||||
if (rcfg.of_node) {
|
||||
|
|
@ -1266,9 +1266,6 @@ int renesas_sdhi_probe(struct platform_device *pdev,
|
|||
|
||||
edisclk:
|
||||
renesas_sdhi_clk_disable(host);
|
||||
efree:
|
||||
tmio_mmc_host_free(host);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(renesas_sdhi_probe);
|
||||
|
|
@ -1279,7 +1276,6 @@ void renesas_sdhi_remove(struct platform_device *pdev)
|
|||
|
||||
tmio_mmc_host_remove(host);
|
||||
renesas_sdhi_clk_disable(host);
|
||||
tmio_mmc_host_free(host);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(renesas_sdhi_remove);
|
||||
|
||||
|
|
|
|||
|
|
@ -199,7 +199,6 @@ struct tmio_mmc_host {
|
|||
|
||||
struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
|
||||
struct tmio_mmc_data *pdata);
|
||||
void tmio_mmc_host_free(struct tmio_mmc_host *host);
|
||||
int tmio_mmc_host_probe(struct tmio_mmc_host *host);
|
||||
void tmio_mmc_host_remove(struct tmio_mmc_host *host);
|
||||
void tmio_mmc_do_data_irq(struct tmio_mmc_host *host);
|
||||
|
|
|
|||
|
|
@ -1097,7 +1097,7 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
|
|||
if (IS_ERR(ctl))
|
||||
return ERR_CAST(ctl);
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev);
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
|
|
@ -1110,29 +1110,17 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
|
|||
mmc->ops = &host->ops;
|
||||
|
||||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret) {
|
||||
host = ERR_PTR(ret);
|
||||
goto free;
|
||||
}
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
tmio_mmc_of_parse(pdev, mmc);
|
||||
|
||||
platform_set_drvdata(pdev, host);
|
||||
|
||||
return host;
|
||||
free:
|
||||
mmc_free_host(mmc);
|
||||
|
||||
return host;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tmio_mmc_host_alloc);
|
||||
|
||||
void tmio_mmc_host_free(struct tmio_mmc_host *host)
|
||||
{
|
||||
mmc_free_host(host->mmc);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tmio_mmc_host_free);
|
||||
|
||||
int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
|
||||
{
|
||||
struct platform_device *pdev = _host->pdev;
|
||||
|
|
|
|||
|
|
@ -663,8 +663,7 @@ static int uniphier_sd_probe(struct platform_device *pdev)
|
|||
priv->rst_hw = devm_reset_control_get_exclusive(dev, "hw");
|
||||
if (IS_ERR(priv->rst_hw)) {
|
||||
dev_err(dev, "failed to get hw reset\n");
|
||||
ret = PTR_ERR(priv->rst_hw);
|
||||
goto free_host;
|
||||
return PTR_ERR(priv->rst_hw);
|
||||
}
|
||||
host->ops.card_hw_reset = uniphier_sd_hw_reset;
|
||||
}
|
||||
|
|
@ -694,7 +693,7 @@ static int uniphier_sd_probe(struct platform_device *pdev)
|
|||
|
||||
ret = uniphier_sd_clk_enable(host);
|
||||
if (ret)
|
||||
goto free_host;
|
||||
return ret;
|
||||
|
||||
uniphier_sd_host_init(host);
|
||||
|
||||
|
|
@ -720,8 +719,6 @@ static int uniphier_sd_probe(struct platform_device *pdev)
|
|||
|
||||
disable_clk:
|
||||
uniphier_sd_clk_disable(host);
|
||||
free_host:
|
||||
tmio_mmc_host_free(host);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -732,7 +729,6 @@ static void uniphier_sd_remove(struct platform_device *pdev)
|
|||
|
||||
tmio_mmc_host_remove(host);
|
||||
uniphier_sd_clk_disable(host);
|
||||
tmio_mmc_host_free(host);
|
||||
}
|
||||
|
||||
static const struct of_device_id uniphier_sd_match[] = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue