mmc: sdhci: disable the clock in sdhci_pltfm_unregister()
authorKevin Hao <haokexin@gmail.com>
Fri, 27 Feb 2015 07:47:30 +0000 (15:47 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 23 Mar 2015 13:13:34 +0000 (14:13 +0100)
So we can avoid to sprinkle the clk_disable_unprepare() in many
drivers.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-bcm-kona.c
drivers/mmc/host/sdhci-dove.c
drivers/mmc/host/sdhci-of-arasan.c
drivers/mmc/host/sdhci-pltfm.c
drivers/mmc/host/sdhci-sirf.c
drivers/mmc/host/sdhci-st.c
drivers/mmc/host/sdhci-tegra.c

index 5bc263b447b21dc5f6a8d90cdc3de540c26f38ca..91cba26f75af55f7660e466b0993b52528d603a5 100644 (file)
@@ -325,17 +325,7 @@ err_pltfm_free:
 
 static int sdhci_bcm_kona_remove(struct platform_device *pdev)
 {
-       struct sdhci_host *host = platform_get_drvdata(pdev);
-       struct sdhci_pltfm_host *pltfm_priv = sdhci_priv(host);
-       int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
-
-       sdhci_remove_host(host, dead);
-
-       clk_disable_unprepare(pltfm_priv->clk);
-
-       sdhci_pltfm_free(pdev);
-
-       return 0;
+       return sdhci_pltfm_unregister(pdev);
 }
 
 static struct platform_driver sdhci_bcm_kona_driver = {
index f78440ef1ba4f0531373fa4ebf11384547aa7b3e..2314ff88d9428efde5c14319343d01c16f03b359 100644 (file)
@@ -110,13 +110,7 @@ err_sdhci_add:
 
 static int sdhci_dove_remove(struct platform_device *pdev)
 {
-       struct sdhci_host *host = platform_get_drvdata(pdev);
-       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-
-       clk_disable_unprepare(pltfm_host->clk);
-       sdhci_pltfm_unregister(pdev);
-
-       return 0;
+       return sdhci_pltfm_unregister(pdev);
 }
 
 static const struct of_device_id sdhci_dove_of_match_table[] = {
index bcb51e9dfdcd0789866ca7739a60444106f88770..129079fb53bf9f77de38a31a11f64552a8228e38 100644 (file)
@@ -195,7 +195,6 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
        struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
        struct sdhci_arasan_data *sdhci_arasan = pltfm_host->priv;
 
-       clk_disable_unprepare(pltfm_host->clk);
        clk_disable_unprepare(sdhci_arasan->clk_ahb);
 
        return sdhci_pltfm_unregister(pdev);
index c5b01d6bb85d41fdf236473b4f2b25cae9ee68f5..74c58d9a4fc8bd5e90fbe96d393cc7d22204fd3d 100644 (file)
@@ -225,9 +225,11 @@ EXPORT_SYMBOL_GPL(sdhci_pltfm_register);
 int sdhci_pltfm_unregister(struct platform_device *pdev)
 {
        struct sdhci_host *host = platform_get_drvdata(pdev);
+       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
        int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
 
        sdhci_remove_host(host, dead);
+       clk_disable_unprepare(pltfm_host->clk);
        sdhci_pltfm_free(pdev);
 
        return 0;
index 0f75aa98c5500b11b1272582ec3362876cdeb76d..f3c8d8d9fc62bbdd385385df39b8487e54b8e27e 100644 (file)
@@ -196,11 +196,8 @@ err_clk_prepare:
 static int sdhci_sirf_remove(struct platform_device *pdev)
 {
        struct sdhci_host *host = platform_get_drvdata(pdev);
-       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 
-       clk_disable_unprepare(pltfm_host->clk);
-       sdhci_pltfm_unregister(pdev);
-       return 0;
+       return sdhci_pltfm_unregister(pdev);
 }
 
 #ifdef CONFIG_PM_SLEEP
index 882b07e9667e20d3675620152cf108fc55f2a3ae..0019df452522cf75db3eebb0462a261d95d549f3 100644 (file)
@@ -115,11 +115,6 @@ err_of:
 
 static int sdhci_st_remove(struct platform_device *pdev)
 {
-       struct sdhci_host *host = platform_get_drvdata(pdev);
-       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-
-       clk_disable_unprepare(pltfm_host->clk);
-
        return sdhci_pltfm_unregister(pdev);
 }
 
index 0643f66b4e142c57744ce03690b51477052c18f4..12881e05ff30bd402519829b99f045faa8dcbab1 100644 (file)
@@ -323,17 +323,7 @@ err_alloc_tegra_host:
 
 static int sdhci_tegra_remove(struct platform_device *pdev)
 {
-       struct sdhci_host *host = platform_get_drvdata(pdev);
-       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-       int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
-
-       sdhci_remove_host(host, dead);
-
-       clk_disable_unprepare(pltfm_host->clk);
-
-       sdhci_pltfm_free(pdev);
-
-       return 0;
+       return sdhci_pltfm_unregister(pdev);
 }
 
 static struct platform_driver sdhci_tegra_driver = {