[PATCH] regulator: Rail is said to be enable only if this and supply rails are enabled.

From: Laxman Dewangan
Date: Tue Jan 03 2012 - 01:11:45 EST


From: Laxman Dewangan <ldewangan@xxxxxxxxxx>

The given rail is said to be enabled only if this rail is eanbled
along with supply rail.
Adding check for the supply rail whether it is enabled or not when
query about rail enabled.

Signed-off-by: Laxman Dewangan <ldewangan@xxxxxxxxxx>
---
When consumer of any rails query about whether rail is enabled
or not, the function regulator_is_enabled() should return enabled
only if this rail and supply rail (both) are enabled.
if any one of rail, whether the given rail or supply rail, is enabled
then function should return as not enabled.

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/