Skip to content

Commit c21f1b0

Browse files
ahunter6Ulf Hansson
authored andcommitted
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: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230811130351.7038-14-adrian.hunter@intel.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 18ba91a commit c21f1b0

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

drivers/mmc/host/sdhci-pxav2.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -268,26 +268,21 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
268268
pltfm_host = sdhci_priv(host);
269269
pxav2_host = sdhci_pltfm_priv(pltfm_host);
270270

271-
clk = devm_clk_get(dev, "io");
272-
if (IS_ERR(clk) && PTR_ERR(clk) != -EPROBE_DEFER)
273-
clk = devm_clk_get(dev, NULL);
271+
clk = devm_clk_get_optional_enabled(dev, "io");
272+
if (!clk)
273+
clk = devm_clk_get_enabled(dev, NULL);
274274
if (IS_ERR(clk)) {
275275
ret = PTR_ERR(clk);
276276
dev_err_probe(dev, ret, "failed to get io clock\n");
277277
goto free;
278278
}
279279
pltfm_host->clk = clk;
280-
ret = clk_prepare_enable(clk);
281-
if (ret) {
282-
dev_err(dev, "failed to enable io clock\n");
283-
goto free;
284-
}
285280

286281
clk_core = devm_clk_get_optional_enabled(dev, "core");
287282
if (IS_ERR(clk_core)) {
288283
ret = PTR_ERR(clk_core);
289284
dev_err_probe(dev, ret, "failed to enable core clock\n");
290-
goto disable_clk;
285+
goto free;
291286
}
292287

293288
host->quirks = SDHCI_QUIRK_BROKEN_ADMA
@@ -339,12 +334,10 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
339334

340335
ret = sdhci_add_host(host);
341336
if (ret)
342-
goto disable_clk;
337+
goto free;
343338

344339
return 0;
345340

346-
disable_clk:
347-
clk_disable_unprepare(clk);
348341
free:
349342
sdhci_pltfm_free(pdev);
350343
return ret;
@@ -358,7 +351,7 @@ static struct platform_driver sdhci_pxav2_driver = {
358351
.pm = &sdhci_pltfm_pmops,
359352
},
360353
.probe = sdhci_pxav2_probe,
361-
.remove_new = sdhci_pltfm_unregister,
354+
.remove_new = sdhci_pltfm_remove,
362355
};
363356

364357
module_platform_driver(sdhci_pxav2_driver);

0 commit comments

Comments
 (0)