public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-mmc@vger.kernel.org
Cc: Piotr Sroka <piotrs@cadence.com>, Hu Ziji <huziji@marvell.com>,
	Christian Daudt <csd@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Zhangfei Gao <zhangfei.gao@marvell.com>,
	Kevin Hao <haokexin@gmail.com>, Olof Johansson <olof@lixom.net>,
	linux-kernel@vger.kernel.org,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Jisheng Zhang <jszhang@marvell.com>
Subject: Re: [PATCH v3 2/4] mmc: sdhci-pxav2: switch to managed clk and sdhci_pltfm_unregister()
Date: Mon, 21 Aug 2017 15:03:42 +0300	[thread overview]
Message-ID: <9574e0c7-4ac4-63d3-3cdf-7ca0e27a7a12@intel.com> (raw)
In-Reply-To: <1502811922-9346-3-git-send-email-yamada.masahiro@socionext.com>

On 15/08/17 18:45, Masahiro Yamada wrote:
> The difference between sdhci_pxav2_remove() and sdhci_pltfm_unregister()
> is clk_put().  It will go away by using the managed resource clk, then
> sdhci_pltfm_unregister() can be reused.
> 
> Also, rename the jump labels to say what the goto does. (Coding style
> suggested by Documentation/process/coding-style.rst)
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Cc'ing Jisheng Zhang, but looks ok to me.

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
> 
> Changes in v3:
>   - Newly added
> 
> Changes in v2: None
> 
>  drivers/mmc/host/sdhci-pxav2.c | 30 +++++++-----------------------
>  1 file changed, 7 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
> index 995083ce1c46..8986f9d9cf98 100644
> --- a/drivers/mmc/host/sdhci-pxav2.c
> +++ b/drivers/mmc/host/sdhci-pxav2.c
> @@ -178,17 +178,17 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
>  
>  	pltfm_host = sdhci_priv(host);
>  
> -	clk = clk_get(dev, "PXA-SDHCLK");
> +	clk = devm_clk_get(dev, "PXA-SDHCLK");
>  	if (IS_ERR(clk)) {
>  		dev_err(dev, "failed to get io clock\n");
>  		ret = PTR_ERR(clk);
> -		goto err_clk_get;
> +		goto free;
>  	}
>  	pltfm_host->clk = clk;
>  	ret = clk_prepare_enable(clk);
>  	if (ret) {
>  		dev_err(&pdev->dev, "failed to enable io clock\n");
> -		goto err_clk_enable;
> +		goto free;
>  	}
>  
>  	host->quirks = SDHCI_QUIRK_BROKEN_ADMA
> @@ -223,34 +223,18 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
>  	ret = sdhci_add_host(host);
>  	if (ret) {
>  		dev_err(&pdev->dev, "failed to add host\n");
> -		goto err_add_host;
> +		goto disable_clk;
>  	}
>  
>  	return 0;
>  
> -err_add_host:
> +disable_clk:
>  	clk_disable_unprepare(clk);
> -err_clk_enable:
> -	clk_put(clk);
> -err_clk_get:
> +free:
>  	sdhci_pltfm_free(pdev);
>  	return ret;
>  }
>  
> -static int sdhci_pxav2_remove(struct platform_device *pdev)
> -{
> -	struct sdhci_host *host = platform_get_drvdata(pdev);
> -	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -
> -	sdhci_remove_host(host, 1);
> -
> -	clk_disable_unprepare(pltfm_host->clk);
> -	clk_put(pltfm_host->clk);
> -	sdhci_pltfm_free(pdev);
> -
> -	return 0;
> -}
> -
>  static struct platform_driver sdhci_pxav2_driver = {
>  	.driver		= {
>  		.name	= "sdhci-pxav2",
> @@ -258,7 +242,7 @@ static struct platform_driver sdhci_pxav2_driver = {
>  		.pm	= &sdhci_pltfm_pmops,
>  	},
>  	.probe		= sdhci_pxav2_probe,
> -	.remove		= sdhci_pxav2_remove,
> +	.remove		= sdhci_pltfm_unregister,
>  };
>  
>  module_platform_driver(sdhci_pxav2_driver);
> 


  reply	other threads:[~2017-08-21 12:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15 15:45 [PATCH v3 0/4] mmc: sdhci: refactor PM in sdhci-pltfm add support PM for cadence port Masahiro Yamada
2017-08-15 15:45 ` [PATCH v3 1/4] mmc: sdhci-cadence: add suspend / resume support Masahiro Yamada
2017-08-21 11:48   ` Adrian Hunter
2017-08-21 12:29     ` Masahiro Yamada
2017-08-15 15:45 ` [PATCH v3 2/4] mmc: sdhci-pxav2: switch to managed clk and sdhci_pltfm_unregister() Masahiro Yamada
2017-08-21 12:03   ` Adrian Hunter [this message]
2017-08-22 10:13     ` Jisheng Zhang
2017-08-15 15:45 ` [PATCH v3 3/4] mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume Masahiro Yamada
2017-08-15 15:45 ` [PATCH v3 4/4] mmc: sdhci-pltfm: export sdhci_pltfm_suspend/resume Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9574e0c7-4ac4-63d3-3cdf-7ca0e27a7a12@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=csd@broadcom.com \
    --cc=haokexin@gmail.com \
    --cc=huziji@marvell.com \
    --cc=jszhang@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=piotrs@cadence.com \
    --cc=sbranden@broadcom.com \
    --cc=ulf.hansson@linaro.org \
    --cc=yamada.masahiro@socionext.com \
    --cc=zhangfei.gao@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox