All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci: Conditionalize regulator_get() on CONFIG_REGULATOR
@ 2011-04-30  4:35 Chris Ball
  2011-04-30 15:06 ` Lars-Peter Clausen
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Ball @ 2011-04-30  4:35 UTC (permalink / raw)
  To: linux-mmc; +Cc: Jaehoon Chung

The regulator subsystem provides stubbed out versions of its calls that
are always present (so that they can be used without needing #ifdefs).
But the regulator_get() stub always returns an error value according
to IS_ERR(), which leads sdhci to print messages like "mmc0: no vmmc
regulator found" on every boot, even if CONFIG_REGULATOR is not set.

This patch fixes that (and removes the unwanted message) by having
the regulator_get() call occur inside an #ifdef CONFIG_REGULATOR.

Reported-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
---
 drivers/mmc/host/sdhci.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index e5cfe70..e29e77a 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2059,15 +2059,17 @@ int sdhci_add_host(struct sdhci_host *host)
 		mmc_hostname(mmc), host);
 	if (ret)
 		goto untasklet;
 
+#ifdef CONFIG_REGULATOR
 	host->vmmc = regulator_get(mmc_dev(mmc), "vmmc");
 	if (IS_ERR(host->vmmc)) {
 		printk(KERN_INFO "%s: no vmmc regulator found\n", mmc_hostname(mmc));
 		host->vmmc = NULL;
 	} else {
 		regulator_enable(host->vmmc);
 	}
+#endif /* CONFIG_REGULATOR */
 
 	sdhci_init(host, 0);
 
 #ifdef CONFIG_MMC_DEBUG
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

* Re: [PATCH] mmc: sdhci: Conditionalize regulator_get() on CONFIG_REGULATOR
  2011-04-30  4:35 [PATCH] mmc: sdhci: Conditionalize regulator_get() on CONFIG_REGULATOR Chris Ball
@ 2011-04-30 15:06 ` Lars-Peter Clausen
  2011-04-30 16:03   ` Chris Ball
  0 siblings, 1 reply; 3+ messages in thread
From: Lars-Peter Clausen @ 2011-04-30 15:06 UTC (permalink / raw)
  To: Chris Ball; +Cc: linux-mmc, Jaehoon Chung

On 04/30/2011 06:35 AM, Chris Ball wrote:
> The regulator subsystem provides stubbed out versions of its calls that
> are always present (so that they can be used without needing #ifdefs).
> But the regulator_get() stub always returns an error value according
> to IS_ERR(), which leads sdhci to print messages like "mmc0: no vmmc
> regulator found" on every boot, even if CONFIG_REGULATOR is not set.
> 
> This patch fixes that (and removes the unwanted message) by having
> the regulator_get() call occur inside an #ifdef CONFIG_REGULATOR.

Shouldn't the stubbed version of regulator_get return NULL, which is not
treated as an error by IS_ERR?

- Lars

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

* Re: [PATCH] mmc: sdhci: Conditionalize regulator_get() on CONFIG_REGULATOR
  2011-04-30 15:06 ` Lars-Peter Clausen
@ 2011-04-30 16:03   ` Chris Ball
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Ball @ 2011-04-30 16:03 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: linux-mmc, Jaehoon Chung

Hi Lars,

On Sat, Apr 30 2011, Lars-Peter Clausen wrote:
> On 04/30/2011 06:35 AM, Chris Ball wrote:
>> The regulator subsystem provides stubbed out versions of its calls that
>> are always present (so that they can be used without needing #ifdefs).
>> But the regulator_get() stub always returns an error value according
>> to IS_ERR(), which leads sdhci to print messages like "mmc0: no vmmc
>> regulator found" on every boot, even if CONFIG_REGULATOR is not set.
>> 
>> This patch fixes that (and removes the unwanted message) by having
>> the regulator_get() call occur inside an #ifdef CONFIG_REGULATOR.
>
> Shouldn't the stubbed version of regulator_get return NULL, which is not
> treated as an error by IS_ERR?

Oops, thanks -- you're right, of course.  I withdraw the patch.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

end of thread, other threads:[~2011-04-30 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-30  4:35 [PATCH] mmc: sdhci: Conditionalize regulator_get() on CONFIG_REGULATOR Chris Ball
2011-04-30 15:06 ` Lars-Peter Clausen
2011-04-30 16:03   ` Chris Ball

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.