aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Martinez Canillas <javier.martinez@collabora.co.uk>2015-03-02 15:40:39 -0500
committerMark Brown <broonie@kernel.org>2015-03-08 15:40:16 -0400
commit0548bf4f5ad6fc3bd93c4940fa48078b34609682 (patch)
treed35bb0b948c53be97a96a776acde955e0d24363c
parentc517d838eb7d07bbe9507871fab3931deccff539 (diff)
regulator: Only enable disabled regulators on resume
The _regulator_do_enable() call ought to be a no-op when called on an already-enabled regulator. However, as an optimization _regulator_enable() doesn't call _regulator_do_enable() on an already enabled regulator. That means we never test the case of calling _regulator_do_enable() during normal usage and there may be hidden bugs or warnings. We have seen warnings issued by the tps65090 driver and bugs when using the GPIO enable pin. Let's match the same optimization that _regulator_enable() in regulator_suspend_finish(). That may speed up suspend/resume and also avoids exposing hidden bugs. [Use much clearer commit message from Doug Anderson] Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
-rw-r--r--drivers/regulator/core.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index b899947d839d..0e271e57504a 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3807,9 +3807,11 @@ int regulator_suspend_finish(void)
3807 list_for_each_entry(rdev, &regulator_list, list) { 3807 list_for_each_entry(rdev, &regulator_list, list) {
3808 mutex_lock(&rdev->mutex); 3808 mutex_lock(&rdev->mutex);
3809 if (rdev->use_count > 0 || rdev->constraints->always_on) { 3809 if (rdev->use_count > 0 || rdev->constraints->always_on) {
3810 error = _regulator_do_enable(rdev); 3810 if (!_regulator_is_enabled(rdev)) {
3811 if (error) 3811 error = _regulator_do_enable(rdev);
3812 ret = error; 3812 if (error)
3813 ret = error;
3814 }
3813 } else { 3815 } else {
3814 if (!have_full_constraints()) 3816 if (!have_full_constraints())
3815 goto unlock; 3817 goto unlock;