Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757245Ab2JWQYD (ORCPT ); Tue, 23 Oct 2012 12:24:03 -0400 Received: from avon.wwwdotorg.org ([70.85.31.133]:51648 "EHLO avon.wwwdotorg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754531Ab2JWQYB (ORCPT ); Tue, 23 Oct 2012 12:24:01 -0400 Message-ID: <5086C49E.8040809@wwwdotorg.org> Date: Tue, 23 Oct 2012 10:23:58 -0600 From: Stephen Warren User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 MIME-Version: 1.0 To: Pavan Kunapuli CC: linux@arm.linux.org.uk, cjb@laptop.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org Subject: Re: [PATCH 2/2] mmc: sdhci: Defer probe if regulator_get fails References: <1350976709-19248-1-git-send-email-pkunapuli@nvidia.com> <1350976709-19248-3-git-send-email-pkunapuli@nvidia.com> In-Reply-To: <1350976709-19248-3-git-send-email-pkunapuli@nvidia.com> X-Enigmail-Version: 1.4.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1957 Lines: 51 On 10/23/2012 01:18 AM, Pavan Kunapuli wrote: > vmmc and vqmmc regulators control the voltage to > the host and device. Defer the probe if either of > them is not registered. > > Signed-off-by: Pavan Kunapuli > --- > drivers/mmc/host/sdhci.c | 25 ++++++++++++++++++++++--- > 1 files changed, 22 insertions(+), 3 deletions(-) > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index 7922adb..925c403 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -2844,11 +2844,17 @@ int sdhci_add_host(struct sdhci_host *host) > !(host->mmc->caps & MMC_CAP_NONREMOVABLE)) > mmc->caps |= MMC_CAP_NEEDS_POLL; > > - /* If vqmmc regulator and no 1.8V signalling, then there's no UHS */ > + /* > + * If vqmmc regulator and no 1.8V signalling, then there's no UHS. > + * vqmmc regulator should be present. If it's not present, > + * assume the regulator driver registration is not yet done and > + * defer the probe. > + */ > host->vqmmc = regulator_get(mmc_dev(mmc), "vqmmc"); > if (IS_ERR(host->vqmmc)) { > - pr_info("%s: no vqmmc regulator found\n", mmc_hostname(mmc)); > + pr_err("%s: no vqmmc regulator found\n", mmc_hostname(mmc)); > host->vqmmc = NULL; > + return -EPROBE_DEFER; > } Right now, the regulator is optional, and any failure to acquire the regulator is just ignored. Instead, I think the behaviour we want is: Attempt to get regulator. 1) If no error -> OK 2) If deferred probe error -> return -EPROBE_DEFER 3) If any other error -> ignore it Assuming that regulator_get() can explicitly detect and return the difference between cases (1) and (2) above. If it can't, it seems like it should be able to. -- 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/