Commit b6c90da3 authored by Adrian Hunter's avatar Adrian Hunter Committed by Ulf Hansson

mmc: sdhci-brcmstb: Use sdhci_pltfm_remove()

Use sdhci_pltfm_remove() instead of sdhci_pltfm_unregister() so that
devm_clk_get_optional_enabled() can be used for pltfm_host->clk.

This has the side effect that the order of operations on the error path
and remove path is not the same as it was before, but should be safe
nevertheless.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230811130351.7038-4-adrian.hunter@intel.comSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 8ebb607a
...@@ -264,23 +264,17 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev) ...@@ -264,23 +264,17 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "Probe found match for %s\n", match->compatible); dev_dbg(&pdev->dev, "Probe found match for %s\n", match->compatible);
clk = devm_clk_get_optional(&pdev->dev, NULL); clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
if (IS_ERR(clk)) if (IS_ERR(clk))
return dev_err_probe(&pdev->dev, PTR_ERR(clk), return dev_err_probe(&pdev->dev, PTR_ERR(clk),
"Failed to get clock from Device Tree\n"); "Failed to get and enable clock from Device Tree\n");
res = clk_prepare_enable(clk);
if (res)
return res;
memset(&brcmstb_pdata, 0, sizeof(brcmstb_pdata)); memset(&brcmstb_pdata, 0, sizeof(brcmstb_pdata));
brcmstb_pdata.ops = match_priv->ops; brcmstb_pdata.ops = match_priv->ops;
host = sdhci_pltfm_init(pdev, &brcmstb_pdata, host = sdhci_pltfm_init(pdev, &brcmstb_pdata,
sizeof(struct sdhci_brcmstb_priv)); sizeof(struct sdhci_brcmstb_priv));
if (IS_ERR(host)) { if (IS_ERR(host))
res = PTR_ERR(host); return PTR_ERR(host);
goto err_clk;
}
pltfm_host = sdhci_priv(host); pltfm_host = sdhci_priv(host);
priv = sdhci_pltfm_priv(pltfm_host); priv = sdhci_pltfm_priv(pltfm_host);
...@@ -369,9 +363,7 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev) ...@@ -369,9 +363,7 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
err: err:
sdhci_pltfm_free(pdev); sdhci_pltfm_free(pdev);
err_clk:
clk_disable_unprepare(base_clk); clk_disable_unprepare(base_clk);
clk_disable_unprepare(clk);
return res; return res;
} }
...@@ -430,7 +422,7 @@ static struct platform_driver sdhci_brcmstb_driver = { ...@@ -430,7 +422,7 @@ static struct platform_driver sdhci_brcmstb_driver = {
.of_match_table = of_match_ptr(sdhci_brcm_of_match), .of_match_table = of_match_ptr(sdhci_brcm_of_match),
}, },
.probe = sdhci_brcmstb_probe, .probe = sdhci_brcmstb_probe,
.remove_new = sdhci_pltfm_unregister, .remove_new = sdhci_pltfm_remove,
.shutdown = sdhci_brcmstb_shutdown, .shutdown = sdhci_brcmstb_shutdown,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment