diff mbox

[RFC,v3,1/8] mmc: omap_hsmmc: use devm_regulator API

Message ID 1385043627-30439-2-git-send-email-balajitk@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Balaji T K Nov. 21, 2013, 2:20 p.m. UTC
Use devm_regulator API, while at it use
devm_regulator_get_optional for optional vmmc_aux supply

Signed-off-by: Balaji T K <balajitk@ti.com>
---
 drivers/mmc/host/omap_hsmmc.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

Comments

Ulf Hansson Nov. 21, 2013, 3:08 p.m. UTC | #1
On 21 November 2013 15:20, Balaji T K <balajitk@ti.com> wrote:
> Use devm_regulator API, while at it use
> devm_regulator_get_optional for optional vmmc_aux supply
>
> Signed-off-by: Balaji T K <balajitk@ti.com>
> ---
>  drivers/mmc/host/omap_hsmmc.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index dbd32ad..1eb4350 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -316,7 +316,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
>         struct regulator *reg;
>         int ocr_value = 0;
>
> -       reg = regulator_get(host->dev, "vmmc");
> +       reg = devm_regulator_get(host->dev, "vmmc");
>         if (IS_ERR(reg)) {
>                 dev_err(host->dev, "vmmc regulator missing\n");
>                 return PTR_ERR(reg);
> @@ -336,7 +336,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
>                 }
>
>                 /* Allow an aux regulator */
> -               reg = regulator_get(host->dev, "vmmc_aux");
> +               reg = devm_regulator_get_optional(host->dev, "vmmc_aux");
>                 host->vcc_aux = IS_ERR(reg) ? NULL : reg;
>
>                 /* For eMMC do not power off when not in sleep state */
> @@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
>
>  static void omap_hsmmc_reg_put(struct omap_hsmmc_host *host)
>  {
> -       regulator_put(host->vcc);
> -       regulator_put(host->vcc_aux);
>         mmc_slot(host).set_power = NULL;
>  }

While you are touching this code I would suggest to convert to
mmc_regulator_get_supply instead. That mean the vmmc_aux change name
to vqmmc though, so you need to adapt for this as well then.

Kind regards
Ulf Hansson

>
> --
> 1.7.5.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
--
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
Balaji T K Dec. 5, 2013, 3:29 p.m. UTC | #2
On Thursday 21 November 2013 08:38 PM, Ulf Hansson wrote:
> On 21 November 2013 15:20, Balaji T K <balajitk@ti.com> wrote:
>> Use devm_regulator API, while at it use
>> devm_regulator_get_optional for optional vmmc_aux supply
>>
>> Signed-off-by: Balaji T K <balajitk@ti.com>
>> ---
>>   drivers/mmc/host/omap_hsmmc.c |    6 ++----
>>   1 files changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>> index dbd32ad..1eb4350 100644
>> --- a/drivers/mmc/host/omap_hsmmc.c
>> +++ b/drivers/mmc/host/omap_hsmmc.c
>> @@ -316,7 +316,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
>>          struct regulator *reg;
>>          int ocr_value = 0;
>>
>> -       reg = regulator_get(host->dev, "vmmc");
>> +       reg = devm_regulator_get(host->dev, "vmmc");
>>          if (IS_ERR(reg)) {
>>                  dev_err(host->dev, "vmmc regulator missing\n");
>>                  return PTR_ERR(reg);
>> @@ -336,7 +336,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
>>                  }
>>
>>                  /* Allow an aux regulator */
>> -               reg = regulator_get(host->dev, "vmmc_aux");
>> +               reg = devm_regulator_get_optional(host->dev, "vmmc_aux");
>>                  host->vcc_aux = IS_ERR(reg) ? NULL : reg;
>>
>>                  /* For eMMC do not power off when not in sleep state */
>> @@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
>>
>>   static void omap_hsmmc_reg_put(struct omap_hsmmc_host *host)
>>   {
>> -       regulator_put(host->vcc);
>> -       regulator_put(host->vcc_aux);
>>          mmc_slot(host).set_power = NULL;
>>   }
>
> While you are touching this code I would suggest to convert to
> mmc_regulator_get_supply instead. That mean the vmmc_aux change name
> to vqmmc though, so you need to adapt for this as well then.
>

Hi Ulf,

Thanks for the comments, I will address it on separate series.

Thanks and Regards,
Balaji T K
--
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/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index dbd32ad..1eb4350 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -316,7 +316,7 @@  static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 	struct regulator *reg;
 	int ocr_value = 0;
 
-	reg = regulator_get(host->dev, "vmmc");
+	reg = devm_regulator_get(host->dev, "vmmc");
 	if (IS_ERR(reg)) {
 		dev_err(host->dev, "vmmc regulator missing\n");
 		return PTR_ERR(reg);
@@ -336,7 +336,7 @@  static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 		}
 
 		/* Allow an aux regulator */
-		reg = regulator_get(host->dev, "vmmc_aux");
+		reg = devm_regulator_get_optional(host->dev, "vmmc_aux");
 		host->vcc_aux = IS_ERR(reg) ? NULL : reg;
 
 		/* For eMMC do not power off when not in sleep state */
@@ -366,8 +366,6 @@  static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 
 static void omap_hsmmc_reg_put(struct omap_hsmmc_host *host)
 {
-	regulator_put(host->vcc);
-	regulator_put(host->vcc_aux);
 	mmc_slot(host).set_power = NULL;
 }