diff mbox

[2/3] mmc: sdhci-esdhc-imx: Changes the order of how clocks are being re-enabled

Message ID 1515079859-18401-2-git-send-email-michael@amarulasolutions.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Nazzareno Trimarchi Jan. 4, 2018, 3:30 p.m. UTC
runtime_resume() should re-enable the clocks in reverse order comparing with
runtime_suspend()

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Comments

Ulf Hansson Jan. 9, 2018, 8:23 a.m. UTC | #1
On 4 January 2018 at 16:30, Michael Trimarchi
<michael@amarulasolutions.com> wrote:
> runtime_resume() should re-enable the clocks in reverse order comparing with
> runtime_suspend()
>
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>

Thanks, applied for next!

Adrian, please tell me if you are not happy with this.

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index d08c21e..6d4e323 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1411,31 +1411,33 @@ static int sdhci_esdhc_runtime_resume(struct device *dev)
>         struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
>         int err;
>
> +       err = clk_prepare_enable(imx_data->clk_ahb);
> +       if (err)
> +               return err;
> +
>         if (!sdhci_sdio_irq_enabled(host)) {
>                 err = clk_prepare_enable(imx_data->clk_per);
>                 if (err)
> -                       return err;
> +                       goto disable_ahb_clk;
>                 err = clk_prepare_enable(imx_data->clk_ipg);
>                 if (err)
>                         goto disable_per_clk;
>         }
> -       err = clk_prepare_enable(imx_data->clk_ahb);
> -       if (err)
> -               goto disable_ipg_clk;
> +
>         err = sdhci_runtime_resume_host(host);
>         if (err)
> -               goto disable_ahb_clk;
> +               goto disable_ipg_clk;
>
>         return 0;
>
> -disable_ahb_clk:
> -       clk_disable_unprepare(imx_data->clk_ahb);
>  disable_ipg_clk:
>         if (!sdhci_sdio_irq_enabled(host))
>                 clk_disable_unprepare(imx_data->clk_ipg);
>  disable_per_clk:
>         if (!sdhci_sdio_irq_enabled(host))
>                 clk_disable_unprepare(imx_data->clk_per);
> +disable_ahb_clk:
> +       clk_disable_unprepare(imx_data->clk_ahb);
>         return err;
>  }
>  #endif
> --
> 2.7.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index d08c21e..6d4e323 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1411,31 +1411,33 @@  static int sdhci_esdhc_runtime_resume(struct device *dev)
 	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	int err;
 
+	err = clk_prepare_enable(imx_data->clk_ahb);
+	if (err)
+		return err;
+
 	if (!sdhci_sdio_irq_enabled(host)) {
 		err = clk_prepare_enable(imx_data->clk_per);
 		if (err)
-			return err;
+			goto disable_ahb_clk;
 		err = clk_prepare_enable(imx_data->clk_ipg);
 		if (err)
 			goto disable_per_clk;
 	}
-	err = clk_prepare_enable(imx_data->clk_ahb);
-	if (err)
-		goto disable_ipg_clk;
+
 	err = sdhci_runtime_resume_host(host);
 	if (err)
-		goto disable_ahb_clk;
+		goto disable_ipg_clk;
 
 	return 0;
 
-disable_ahb_clk:
-	clk_disable_unprepare(imx_data->clk_ahb);
 disable_ipg_clk:
 	if (!sdhci_sdio_irq_enabled(host))
 		clk_disable_unprepare(imx_data->clk_ipg);
 disable_per_clk:
 	if (!sdhci_sdio_irq_enabled(host))
 		clk_disable_unprepare(imx_data->clk_per);
+disable_ahb_clk:
+	clk_disable_unprepare(imx_data->clk_ahb);
 	return err;
 }
 #endif