Skip to content

Commit 6996bea

Browse files
ahunter6Ulf Hansson
authored andcommitted
mmc: sdhci-cadence: 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-5-adrian.hunter@intel.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent b6c90da commit 6996bea

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

drivers/mmc/host/sdhci-cadence.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -487,25 +487,19 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
487487
struct device *dev = &pdev->dev;
488488
static const u16 version = SDHCI_SPEC_400 << SDHCI_SPEC_VER_SHIFT;
489489

490-
clk = devm_clk_get(dev, NULL);
490+
clk = devm_clk_get_enabled(dev, NULL);
491491
if (IS_ERR(clk))
492492
return PTR_ERR(clk);
493493

494-
ret = clk_prepare_enable(clk);
495-
if (ret)
496-
return ret;
497-
498494
data = of_device_get_match_data(dev);
499495
if (!data)
500496
data = &sdhci_cdns_drv_data;
501497

502498
nr_phy_params = sdhci_cdns_phy_param_count(dev->of_node);
503499
host = sdhci_pltfm_init(pdev, &data->pltfm_data,
504500
struct_size(priv, phy_params, nr_phy_params));
505-
if (IS_ERR(host)) {
506-
ret = PTR_ERR(host);
507-
goto disable_clk;
508-
}
501+
if (IS_ERR(host))
502+
return PTR_ERR(host);
509503

510504
pltfm_host = sdhci_priv(host);
511505
pltfm_host->clk = clk;
@@ -556,9 +550,6 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
556550
return 0;
557551
free:
558552
sdhci_pltfm_free(pdev);
559-
disable_clk:
560-
clk_disable_unprepare(clk);
561-
562553
return ret;
563554
}
564555

@@ -617,7 +608,7 @@ static struct platform_driver sdhci_cdns_driver = {
617608
.of_match_table = sdhci_cdns_match,
618609
},
619610
.probe = sdhci_cdns_probe,
620-
.remove_new = sdhci_pltfm_unregister,
611+
.remove_new = sdhci_pltfm_remove,
621612
};
622613
module_platform_driver(sdhci_cdns_driver);
623614

0 commit comments

Comments
 (0)