devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
To: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>,
	tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org,
	ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	afenkart-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: nsekhar-l0cyMroinI0@public.gmane.org,
	Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
Subject: Re: [PATCH 01/17] mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc
Date: Wed, 29 Jul 2015 15:09:09 +0300	[thread overview]
Message-ID: <55B8C265.1050801@ti.com> (raw)
In-Reply-To: <1438168187-1614-2-git-send-email-kishon-l0cyMroinI0@public.gmane.org>

On 07/29/2015 02:09 PM, Kishon Vijay Abraham I wrote:
> Since vmmc can be optional for some platforms, use
> devm_regulator_get_optional() for vmmc. Now return error only
> in the case of -EPROBE_DEFER and for all other cases set
> host->vcc to NULL.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> ---
>   drivers/mmc/host/omap_hsmmc.c |    8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 4d12032..b673e59 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -344,11 +344,13 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
>   	struct regulator *reg;
>   	int ocr_value = 0;
>   
> -	reg = devm_regulator_get(host->dev, "vmmc");
> +	reg = devm_regulator_get_optional(host->dev, "vmmc");
>   	if (IS_ERR(reg)) {
> -		dev_err(host->dev, "unable to get vmmc regulator %ld\n",
> +		if (PTR_ERR(reg) == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;
> +		host->vcc = NULL;
> +		dev_dbg(host->dev, "unable to get vmmc regulator %ld\n",
>   			PTR_ERR(reg));
> -		return PTR_ERR(reg);

I think, It could be unsafe to just drop this return.
regulator_get_optional may return:
1 valid pointer on regulator : success;
2 ERR_PTR(-ENODEV)           : regulator is not assigned, can proceed.
3 ERR_PTR(-EPROBE_DEFER)     : regulator is assigned, but not ready yet, retry.
4 ERR_PTR(<other error codes>: regulator is assigned, but can't be retrieved, failure, can't proceed

So, It's allowed to continue with host->vcc = NULL; only in case [2], while
in case [4] probe should fail.

>   	} else {
>   		host->vcc = reg;
>   		ocr_value = mmc_regulator_get_ocrmask(reg);
> 


-- 
regards,
-grygorii
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-07-29 12:09 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-29 11:09 [PATCH 00/17] omap_hsmmc: regulator usage cleanup and fixes Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 01/17] mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc Kishon Vijay Abraham I
     [not found]   ` <1438168187-1614-2-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
2015-07-29 12:09     ` Grygorii Strashko [this message]
2015-07-31 15:29       ` Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 02/17] mmc: host: omap_hsmmc: return error from omap_hsmmc_reg_get on -EPROBE_DEFER Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 03/17] mmc: host: omap_hsmmc: cleanup omap_hsmmc_reg_get() Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 04/17] mmc: host: omap_hsmmc: use the ocrmask provided by the vmmc regulator Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 05/17] mmc: host: omap_hsmmc: use mmc_host's vmmc and vqmmc Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 06/17] mmc: host: omap_hsmmc: remove unnecessary pbias set_voltage Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 07/17] mmc: host: omap_hsmmc: return error if any of the regulator APIs fail Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 08/17] mmc: host: omap_hsmmc: add separate functions for enable/disable supply Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 09/17] mmc: host: omap_hsmmc: add separate function to set pbias Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 10/17] mmc: host: omap_hsmmc: avoid pbias regulator enable on power off Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 11/17] mmc: host: omap_hsmmc: don't use ->set_power to set initial regulator state Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 12/17] ARM: dts: am57xx-beagle-x15: Fix regulator populated in MMC1 dt node Kishon Vijay Abraham I
2015-07-29 19:37   ` Nishanth Menon
     [not found]     ` <55B92B88.1080409-l0cyMroinI0@public.gmane.org>
2015-08-25  6:36       ` Kishon Vijay Abraham I
2015-09-14 17:12         ` Tony Lindgren
2015-07-29 11:09 ` [PATCH 13/17] mmc: host: omap_hsmmc: enable/disable vmmc_aux regulator based on prior state Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 14/17] mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 15/17] mmc: host: omap_hsmmc: use ios->vdd for setting vmmc voltage Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 16/17] mmc: host: omap_hsmmc: remove CONFIG_REGULATOR check Kishon Vijay Abraham I
2015-07-29 11:09 ` [PATCH 17/17] mmc: host: omap_hsmmc: use "mmc_of_parse_voltage" to get ocr_avail Kishon Vijay Abraham I
2015-08-03  7:28 ` [PATCH 00/17] omap_hsmmc: regulator usage cleanup and fixes Andreas Fenkart
     [not found]   ` <CALtMJEDP1-Q9W=x-0hq3tZQ1QZ2LVwVj47=ADYDjT7BsfanffA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-08-03 12:12     ` Kishon Vijay Abraham I

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=55B8C265.1050801@ti.com \
    --to=grygorii.strashko-l0cymroini0@public.gmane.org \
    --cc=afenkart-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kishon-l0cyMroinI0@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nsekhar-l0cyMroinI0@public.gmane.org \
    --cc=rogerq-l0cyMroinI0@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    --cc=ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).