Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: sdhci-iproc: 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-8-adrian.hunter@intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Adrian Hunter and committed by
Ulf Hansson
3f377134 080b5adf

+3 -11
+3 -11
drivers/mmc/host/sdhci-iproc.c
··· 386 386 host->mmc->caps |= iproc_host->data->mmc_caps; 387 387 388 388 if (dev->of_node) { 389 - pltfm_host->clk = devm_clk_get(dev, NULL); 389 + pltfm_host->clk = devm_clk_get_enabled(dev, NULL); 390 390 if (IS_ERR(pltfm_host->clk)) { 391 391 ret = PTR_ERR(pltfm_host->clk); 392 - goto err; 393 - } 394 - ret = clk_prepare_enable(pltfm_host->clk); 395 - if (ret) { 396 - dev_err(dev, "failed to enable host clk\n"); 397 392 goto err; 398 393 } 399 394 } ··· 401 406 402 407 ret = sdhci_add_host(host); 403 408 if (ret) 404 - goto err_clk; 409 + goto err; 405 410 406 411 return 0; 407 412 408 - err_clk: 409 - if (dev->of_node) 410 - clk_disable_unprepare(pltfm_host->clk); 411 413 err: 412 414 sdhci_pltfm_free(pdev); 413 415 return ret; ··· 424 432 .pm = &sdhci_pltfm_pmops, 425 433 }, 426 434 .probe = sdhci_iproc_probe, 427 - .remove_new = sdhci_pltfm_unregister, 435 + .remove_new = sdhci_pltfm_remove, 428 436 .shutdown = sdhci_iproc_shutdown, 429 437 }; 430 438 module_platform_driver(sdhci_iproc_driver);