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

mmc: sdhci-pxav2: Use sdhci_pltfm_remove()

Use sdhci_pltfm_remove() instead of sdhci_pltfm_unregister() so that
devm_clk_get_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-14-adrian.hunter@intel.comSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 18ba91ac
...@@ -268,26 +268,21 @@ static int sdhci_pxav2_probe(struct platform_device *pdev) ...@@ -268,26 +268,21 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
pltfm_host = sdhci_priv(host); pltfm_host = sdhci_priv(host);
pxav2_host = sdhci_pltfm_priv(pltfm_host); pxav2_host = sdhci_pltfm_priv(pltfm_host);
clk = devm_clk_get(dev, "io"); clk = devm_clk_get_optional_enabled(dev, "io");
if (IS_ERR(clk) && PTR_ERR(clk) != -EPROBE_DEFER) if (!clk)
clk = devm_clk_get(dev, NULL); clk = devm_clk_get_enabled(dev, NULL);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
ret = PTR_ERR(clk); ret = PTR_ERR(clk);
dev_err_probe(dev, ret, "failed to get io clock\n"); dev_err_probe(dev, ret, "failed to get io clock\n");
goto free; goto free;
} }
pltfm_host->clk = clk; pltfm_host->clk = clk;
ret = clk_prepare_enable(clk);
if (ret) {
dev_err(dev, "failed to enable io clock\n");
goto free;
}
clk_core = devm_clk_get_optional_enabled(dev, "core"); clk_core = devm_clk_get_optional_enabled(dev, "core");
if (IS_ERR(clk_core)) { if (IS_ERR(clk_core)) {
ret = PTR_ERR(clk_core); ret = PTR_ERR(clk_core);
dev_err_probe(dev, ret, "failed to enable core clock\n"); dev_err_probe(dev, ret, "failed to enable core clock\n");
goto disable_clk; goto free;
} }
host->quirks = SDHCI_QUIRK_BROKEN_ADMA host->quirks = SDHCI_QUIRK_BROKEN_ADMA
...@@ -339,12 +334,10 @@ static int sdhci_pxav2_probe(struct platform_device *pdev) ...@@ -339,12 +334,10 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
ret = sdhci_add_host(host); ret = sdhci_add_host(host);
if (ret) if (ret)
goto disable_clk; goto free;
return 0; return 0;
disable_clk:
clk_disable_unprepare(clk);
free: free:
sdhci_pltfm_free(pdev); sdhci_pltfm_free(pdev);
return ret; return ret;
...@@ -358,7 +351,7 @@ static struct platform_driver sdhci_pxav2_driver = { ...@@ -358,7 +351,7 @@ static struct platform_driver sdhci_pxav2_driver = {
.pm = &sdhci_pltfm_pmops, .pm = &sdhci_pltfm_pmops,
}, },
.probe = sdhci_pxav2_probe, .probe = sdhci_pxav2_probe,
.remove_new = sdhci_pltfm_unregister, .remove_new = sdhci_pltfm_remove,
}; };
module_platform_driver(sdhci_pxav2_driver); module_platform_driver(sdhci_pxav2_driver);
......
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