[PATCH 2/4] regulator: Assume regulators are enabled if they don't report anything

Mike Rapoport mike at compulab.co.il
Thu Apr 29 12:08:27 UTC 2010


From: Mark Brown <broonie at opensource.wolfsonmicro.com>

If a regulator driver does not provide a way to query if the driver is
enabled then assume that it is enabled.  This is very likely to reflect
the actual state is more useful for callers than reporting an error.

Signed-off-by: Mark Brown <broonie at opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg at slimlogic.co.uk>
---
 drivers/regulator/core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index b60a4c9..114a36d 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1434,9 +1434,9 @@ EXPORT_SYMBOL_GPL(regulator_force_disable);
 
 static int _regulator_is_enabled(struct regulator_dev *rdev)
 {
-	/* sanity check */
+	/* If we don't know then assume that the regulator is always on */
 	if (!rdev->desc->ops->is_enabled)
-		return -EINVAL;
+		return 1;
 
 	return rdev->desc->ops->is_enabled(rdev);
 }
-- 
1.6.6.2





More information about the kernel-team mailing list