lkml.org 
[lkml]   [2012]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V2] regulator: Add check for supply rail
Date
From: Laxman Dewangan <ldewangan@nvidia.com>

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@nvidia.com>
---
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


\
 
 \ /
  Last update: 2012-01-03 08:15    [W:0.025 / U:0.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site