public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 2/2] mmc: mxcmmc: fix the default value for available voltages into mxcmci_probe
@ 2014-10-08 14:24 Matteo Facchinetti
  2014-10-10  7:51 ` Sascha Hauer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Matteo Facchinetti @ 2014-10-08 14:24 UTC (permalink / raw)
  To: chris, ulf.hansson
  Cc: shc_work, s.hauer, peter.griffin, linux-mmc, linux-kernel, agust,
	gsi, sbabic, Matteo Facchinetti

From: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>

If available voltages are not given, mmc_regulator_get_supply() function
returns 0 and mxcmmc driver doesn't set a value for ocr_avail mask.

In accordance with the comment in platform_data/mmc-mxcmmc.h,
fix it, assuming MMC_VDD_32_33 | MMC_VDD_33_34 as default value.

Signed-off-by: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>
---
v2:
* Add test to check if mmc->ocr_avail is setted by mmc_regulator_get_supply().
  This will prevent that it be overwritten unconditionally.
---
 drivers/mmc/host/mxcmmc.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index 536a898..5316d9b 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -1077,12 +1077,14 @@ static int mxcmci_probe(struct platform_device *pdev)
 		dat3_card_detect = true;
 
 	ret = mmc_regulator_get_supply(mmc);
-	if (ret) {
-		if (pdata && ret != -EPROBE_DEFER)
-			mmc->ocr_avail = pdata->ocr_avail ? :
-				MMC_VDD_32_33 | MMC_VDD_33_34;
+	if (ret == -EPROBE_DEFER)
+		goto out_free;
+
+	if (!mmc->ocr_avail) {
+		if (pdata && pdata->ocr_avail)
+			mmc->ocr_avail = pdata->ocr_avail;
 		else
-			goto out_free;
+			mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
 	}
 
 	if (dat3_card_detect)
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] mmc: mxcmmc: fix the default value for available voltages into mxcmci_probe
  2014-10-08 14:24 [PATCH v2 2/2] mmc: mxcmmc: fix the default value for available voltages into mxcmci_probe Matteo Facchinetti
@ 2014-10-10  7:51 ` Sascha Hauer
  2014-10-27 10:23 ` Matteo Facchinetti
  2014-10-27 12:12 ` Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2014-10-10  7:51 UTC (permalink / raw)
  To: Matteo Facchinetti
  Cc: chris, ulf.hansson, shc_work, peter.griffin, linux-mmc,
	linux-kernel, agust, gsi, sbabic

On Wed, Oct 08, 2014 at 04:24:33PM +0200, Matteo Facchinetti wrote:
> From: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>
> 
> If available voltages are not given, mmc_regulator_get_supply() function
> returns 0 and mxcmmc driver doesn't set a value for ocr_avail mask.
> 
> In accordance with the comment in platform_data/mmc-mxcmmc.h,
> fix it, assuming MMC_VDD_32_33 | MMC_VDD_33_34 as default value.
> 
> Signed-off-by: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>

Looks okay now.

Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>

Sascha

> ---
> v2:
> * Add test to check if mmc->ocr_avail is setted by mmc_regulator_get_supply().
>   This will prevent that it be overwritten unconditionally.
> ---
>  drivers/mmc/host/mxcmmc.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
> index 536a898..5316d9b 100644
> --- a/drivers/mmc/host/mxcmmc.c
> +++ b/drivers/mmc/host/mxcmmc.c
> @@ -1077,12 +1077,14 @@ static int mxcmci_probe(struct platform_device *pdev)
>  		dat3_card_detect = true;
>  
>  	ret = mmc_regulator_get_supply(mmc);
> -	if (ret) {
> -		if (pdata && ret != -EPROBE_DEFER)
> -			mmc->ocr_avail = pdata->ocr_avail ? :
> -				MMC_VDD_32_33 | MMC_VDD_33_34;
> +	if (ret == -EPROBE_DEFER)
> +		goto out_free;
> +
> +	if (!mmc->ocr_avail) {
> +		if (pdata && pdata->ocr_avail)
> +			mmc->ocr_avail = pdata->ocr_avail;
>  		else
> -			goto out_free;
> +			mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
>  	}
>  
>  	if (dat3_card_detect)
> -- 
> 1.8.3.2
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] mmc: mxcmmc: fix the default value for available voltages into mxcmci_probe
  2014-10-08 14:24 [PATCH v2 2/2] mmc: mxcmmc: fix the default value for available voltages into mxcmci_probe Matteo Facchinetti
  2014-10-10  7:51 ` Sascha Hauer
@ 2014-10-27 10:23 ` Matteo Facchinetti
  2014-10-27 12:12 ` Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Matteo Facchinetti @ 2014-10-27 10:23 UTC (permalink / raw)
  To: chris, ulf.hansson
  Cc: shc_work, s.hauer, peter.griffin, linux-mmc, linux-kernel, agust,
	gsi, sbabic

This patch was reviewed, and seems that work it's complete.

Can you merge?


On 08/10/2014 16:24, Matteo Facchinetti wrote:
> From: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>
>
> If available voltages are not given, mmc_regulator_get_supply() function
> returns 0 and mxcmmc driver doesn't set a value for ocr_avail mask.
>
> In accordance with the comment in platform_data/mmc-mxcmmc.h,
> fix it, assuming MMC_VDD_32_33 | MMC_VDD_33_34 as default value.
>
> Signed-off-by: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>
> ---
> v2:
> * Add test to check if mmc->ocr_avail is setted by mmc_regulator_get_supply().
>    This will prevent that it be overwritten unconditionally.
> ---
>   drivers/mmc/host/mxcmmc.c | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
> index 536a898..5316d9b 100644
> --- a/drivers/mmc/host/mxcmmc.c
> +++ b/drivers/mmc/host/mxcmmc.c
> @@ -1077,12 +1077,14 @@ static int mxcmci_probe(struct platform_device *pdev)
>   		dat3_card_detect = true;
>   
>   	ret = mmc_regulator_get_supply(mmc);
> -	if (ret) {
> -		if (pdata && ret != -EPROBE_DEFER)
> -			mmc->ocr_avail = pdata->ocr_avail ? :
> -				MMC_VDD_32_33 | MMC_VDD_33_34;
> +	if (ret == -EPROBE_DEFER)
> +		goto out_free;
> +
> +	if (!mmc->ocr_avail) {
> +		if (pdata && pdata->ocr_avail)
> +			mmc->ocr_avail = pdata->ocr_avail;
>   		else
> -			goto out_free;
> +			mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
>   	}
>   
>   	if (dat3_card_detect)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] mmc: mxcmmc: fix the default value for available voltages into mxcmci_probe
  2014-10-08 14:24 [PATCH v2 2/2] mmc: mxcmmc: fix the default value for available voltages into mxcmci_probe Matteo Facchinetti
  2014-10-10  7:51 ` Sascha Hauer
  2014-10-27 10:23 ` Matteo Facchinetti
@ 2014-10-27 12:12 ` Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2014-10-27 12:12 UTC (permalink / raw)
  To: Matteo Facchinetti
  Cc: Chris Ball, Alexander Shiyan, Sascha Hauer, Peter Griffin,
	linux-mmc, linux-kernel@vger.kernel.org, Anatolij Gustschin, gsi,
	sbabic

On 8 October 2014 16:24, Matteo Facchinetti
<matteo.facchinetti@sirius-es.it> wrote:
> From: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>
>
> If available voltages are not given, mmc_regulator_get_supply() function
> returns 0 and mxcmmc driver doesn't set a value for ocr_avail mask.
>
> In accordance with the comment in platform_data/mmc-mxcmmc.h,
> fix it, assuming MMC_VDD_32_33 | MMC_VDD_33_34 as default value.
>
> Signed-off-by: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>

Thanks! Applied for next!

Kind regards
Uffe


> ---
> v2:
> * Add test to check if mmc->ocr_avail is setted by mmc_regulator_get_supply().
>   This will prevent that it be overwritten unconditionally.
> ---
>  drivers/mmc/host/mxcmmc.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
> index 536a898..5316d9b 100644
> --- a/drivers/mmc/host/mxcmmc.c
> +++ b/drivers/mmc/host/mxcmmc.c
> @@ -1077,12 +1077,14 @@ static int mxcmci_probe(struct platform_device *pdev)
>                 dat3_card_detect = true;
>
>         ret = mmc_regulator_get_supply(mmc);
> -       if (ret) {
> -               if (pdata && ret != -EPROBE_DEFER)
> -                       mmc->ocr_avail = pdata->ocr_avail ? :
> -                               MMC_VDD_32_33 | MMC_VDD_33_34;
> +       if (ret == -EPROBE_DEFER)
> +               goto out_free;
> +
> +       if (!mmc->ocr_avail) {
> +               if (pdata && pdata->ocr_avail)
> +                       mmc->ocr_avail = pdata->ocr_avail;
>                 else
> -                       goto out_free;
> +                       mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
>         }
>
>         if (dat3_card_detect)
> --
> 1.8.3.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-27 12:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-08 14:24 [PATCH v2 2/2] mmc: mxcmmc: fix the default value for available voltages into mxcmci_probe Matteo Facchinetti
2014-10-10  7:51 ` Sascha Hauer
2014-10-27 10:23 ` Matteo Facchinetti
2014-10-27 12:12 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox