Commit 9a7f6a4c authored by Mark Brown's avatar Mark Brown Committed by Liam Girdwood

regulator: Assume regulators are enabled if they don't report anything

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: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent 17133dc8
...@@ -1466,9 +1466,9 @@ EXPORT_SYMBOL_GPL(regulator_force_disable); ...@@ -1466,9 +1466,9 @@ EXPORT_SYMBOL_GPL(regulator_force_disable);
static int _regulator_is_enabled(struct regulator_dev *rdev) 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) if (!rdev->desc->ops->is_enabled)
return -EINVAL; return 1;
return rdev->desc->ops->is_enabled(rdev); return rdev->desc->ops->is_enabled(rdev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment