Skip to content

Commit 18ba91a

Browse files
ahunter6Ulf Hansson
authored andcommitted
mmc: sdhci-of-sparx5: 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-13-adrian.hunter@intel.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent ed581f2 commit 18ba91a

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

drivers/mmc/host/sdhci-of-sparx5.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,12 @@ static int sdhci_sparx5_probe(struct platform_device *pdev)
184184
sdhci_sparx5 = sdhci_pltfm_priv(pltfm_host);
185185
sdhci_sparx5->host = host;
186186

187-
pltfm_host->clk = devm_clk_get(&pdev->dev, "core");
187+
pltfm_host->clk = devm_clk_get_enabled(&pdev->dev, "core");
188188
if (IS_ERR(pltfm_host->clk)) {
189189
ret = PTR_ERR(pltfm_host->clk);
190-
dev_err(&pdev->dev, "failed to get core clk: %d\n", ret);
190+
dev_err(&pdev->dev, "failed to get and enable core clk: %d\n", ret);
191191
goto free_pltfm;
192192
}
193-
ret = clk_prepare_enable(pltfm_host->clk);
194-
if (ret)
195-
goto free_pltfm;
196193

197194
if (!of_property_read_u32(np, "microchip,clock-delay", &value) &&
198195
(value > 0 && value <= MSHC_DLY_CC_MAX))
@@ -202,13 +199,13 @@ static int sdhci_sparx5_probe(struct platform_device *pdev)
202199

203200
ret = mmc_of_parse(host->mmc);
204201
if (ret)
205-
goto err_clk;
202+
goto free_pltfm;
206203

207204
sdhci_sparx5->cpu_ctrl = syscon_regmap_lookup_by_compatible(syscon);
208205
if (IS_ERR(sdhci_sparx5->cpu_ctrl)) {
209206
dev_err(&pdev->dev, "No CPU syscon regmap !\n");
210207
ret = PTR_ERR(sdhci_sparx5->cpu_ctrl);
211-
goto err_clk;
208+
goto free_pltfm;
212209
}
213210

214211
if (sdhci_sparx5->delay_clock >= 0)
@@ -225,7 +222,7 @@ static int sdhci_sparx5_probe(struct platform_device *pdev)
225222

226223
ret = sdhci_add_host(host);
227224
if (ret)
228-
goto err_clk;
225+
goto free_pltfm;
229226

230227
/* Set AXI bus master to use un-cached access (for DMA) */
231228
if (host->flags & (SDHCI_USE_SDMA | SDHCI_USE_ADMA) &&
@@ -239,8 +236,6 @@ static int sdhci_sparx5_probe(struct platform_device *pdev)
239236

240237
return ret;
241238

242-
err_clk:
243-
clk_disable_unprepare(pltfm_host->clk);
244239
free_pltfm:
245240
sdhci_pltfm_free(pdev);
246241
return ret;
@@ -260,7 +255,7 @@ static struct platform_driver sdhci_sparx5_driver = {
260255
.pm = &sdhci_pltfm_pmops,
261256
},
262257
.probe = sdhci_sparx5_probe,
263-
.remove_new = sdhci_pltfm_unregister,
258+
.remove_new = sdhci_pltfm_remove,
264259
};
265260

266261
module_platform_driver(sdhci_sparx5_driver);

0 commit comments

Comments
 (0)