regulator: Assume regulators are enabled if they don't report anything
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 11 Feb 2010 17:22:45 +0000 (17:22 +0000)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Wed, 3 Mar 2010 14:49:26 +0000 (14:49 +0000)
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@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
drivers/regulator/core.c

index ca8e1642538b73864c47f3617c84ed4570b57e24..75a26f7809184127eec35ea86979fdd6ff7cff44 100644 (file)
@@ -1466,9 +1466,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);
 }