linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] regulator: Add check for supply rail
@ 2012-01-03  7:11 Laxman Dewangan
  0 siblings, 0 replies; only message in thread
From: Laxman Dewangan @ 2012-01-03  7:11 UTC (permalink / raw)
  To: broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E,
	lrg-l0cyMroinI0
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-pm-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	ldewangan-DDmLM1+adcrQT0dZR+AlfA

From: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

When consumer of any rails query about whether rail is enabled
or not, the function regulator_is_enabled() should return enabled
only if requested rail and supply rail (both) are enabled.
If any one of these rails is enabled then function should return as
not enabled.

Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
The commit message and synopsis is changed in this patch.

 drivers/regulator/core.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index dbdebed..d914435 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1701,6 +1701,12 @@ int regulator_is_enabled(struct regulator *regulator)
 {
 	int ret;
 
+	if (regulator->rdev->supply) {
+		ret = regulator_is_enabled(regulator->rdev->supply);
+		if (ret <= 0)
+			return ret;
+	}
+
 	mutex_lock(&regulator->rdev->mutex);
 	ret = _regulator_is_enabled(regulator->rdev);
 	mutex_unlock(&regulator->rdev->mutex);
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-01-03  7:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-03  7:11 [PATCH V2] regulator: Add check for supply rail Laxman Dewangan

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).