diff mbox

[1/1] mmc: mmci: Use devm_regulator_get API

Message ID 1357638169-23321-1-git-send-email-sachin.kamat@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sachin Kamat Jan. 8, 2013, 9:42 a.m. UTC
devm_regulator_get is device managed and saves some cleanup
and exit code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
Compile tested against linux-next tree (20130108).
---
 drivers/mmc/host/mmci.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Comments

Ulf Hansson Jan. 8, 2013, 9:19 p.m. UTC | #1
On 8 January 2013 10:42, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> devm_regulator_get is device managed and saves some cleanup
> and exit code.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> Compile tested against linux-next tree (20130108).
> ---
>  drivers/mmc/host/mmci.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
> index 1507723..3ef9b1f 100644
> --- a/drivers/mmc/host/mmci.c
> +++ b/drivers/mmc/host/mmci.c
> @@ -1386,7 +1386,7 @@ static int mmci_probe(struct amba_device *dev,
>
>  #ifdef CONFIG_REGULATOR
>         /* If we're using the regulator framework, try to fetch a regulator */
> -       host->vcc = regulator_get(&dev->dev, "vmmc");
> +       host->vcc = devm_regulator_get(&dev->dev, "vmmc");

This is not needed. Host drivers shall instead use
mmc_regulator_get_supply API, which is already doing
devm_regulator_get. A patch for mmci to use mmc_regulator_get_supply
API has already been merged through Russell King's ARM tree.

>         if (IS_ERR(host->vcc))
>                 host->vcc = NULL;
>         else {
> @@ -1587,7 +1587,6 @@ static int mmci_remove(struct amba_device *dev)
>
>                 if (host->vcc)
>                         mmc_regulator_set_ocr(mmc, host->vcc, 0);
> -               regulator_put(host->vcc);
>
>                 mmc_free_host(mmc);
>
> --
> 1.7.4.1
>
> --
> 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

Kind regards
Ulf Hansson
--
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/mmci.c b/drivers/mmc/host/mmci.c
index 1507723..3ef9b1f 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -1386,7 +1386,7 @@  static int mmci_probe(struct amba_device *dev,
 
 #ifdef CONFIG_REGULATOR
 	/* If we're using the regulator framework, try to fetch a regulator */
-	host->vcc = regulator_get(&dev->dev, "vmmc");
+	host->vcc = devm_regulator_get(&dev->dev, "vmmc");
 	if (IS_ERR(host->vcc))
 		host->vcc = NULL;
 	else {
@@ -1587,7 +1587,6 @@  static int mmci_remove(struct amba_device *dev)
 
 		if (host->vcc)
 			mmc_regulator_set_ocr(mmc, host->vcc, 0);
-		regulator_put(host->vcc);
 
 		mmc_free_host(mmc);