aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Pargmann <mpa@pengutronix.de>2014-02-20 11:36:03 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-03-24 00:38:14 -0400
commit783d444c6dbca17d2b15918ef6b30add2ba586b8 (patch)
treec13a86f3445c9638ab4f339a094850c52ce169b3
parentf5a82d2f4c8c46d753a739679d905191ca23c443 (diff)
regulator: core: Replace direct ops->enable usage
commit 30c219710358c5cca2f8bd2e9e547c6aadf7cf8b upstream. There are some direct ops->enable in the regulator core driver. This is a potential issue as the function _regulator_do_enable() handles gpio regulators and the normal ops->enable calls. These gpio regulators are simply ignored when ops->enable is called directly. One possible bug is that boot-on and always-on gpio regulators are not enabled on registration. This patch replaces all ops->enable calls by _regulator_do_enable. [Handle missing enable operations -- broonie] Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Mark Brown <broonie@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/regulator/core.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 815d6df8bd5f..c59cc6ed7adb 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -919,6 +919,8 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
919 return 0; 919 return 0;
920} 920}
921 921
922static int _regulator_do_enable(struct regulator_dev *rdev);
923
922/** 924/**
923 * set_machine_constraints - sets regulator constraints 925 * set_machine_constraints - sets regulator constraints
924 * @rdev: regulator source 926 * @rdev: regulator source
@@ -975,10 +977,9 @@ static int set_machine_constraints(struct regulator_dev *rdev,
975 /* If the constraints say the regulator should be on at this point 977 /* If the constraints say the regulator should be on at this point
976 * and we have control then make sure it is enabled. 978 * and we have control then make sure it is enabled.
977 */ 979 */
978 if ((rdev->constraints->always_on || rdev->constraints->boot_on) && 980 if (rdev->constraints->always_on || rdev->constraints->boot_on) {
979 ops->enable) { 981 ret = _regulator_do_enable(rdev);
980 ret = ops->enable(rdev); 982 if (ret < 0 && ret != -EINVAL) {
981 if (ret < 0) {
982 rdev_err(rdev, "failed to enable\n"); 983 rdev_err(rdev, "failed to enable\n");
983 goto out; 984 goto out;
984 } 985 }
@@ -3790,9 +3791,8 @@ int regulator_suspend_finish(void)
3790 struct regulator_ops *ops = rdev->desc->ops; 3791 struct regulator_ops *ops = rdev->desc->ops;
3791 3792
3792 mutex_lock(&rdev->mutex); 3793 mutex_lock(&rdev->mutex);
3793 if ((rdev->use_count > 0 || rdev->constraints->always_on) && 3794 if (rdev->use_count > 0 || rdev->constraints->always_on) {
3794 ops->enable) { 3795 error = _regulator_do_enable(rdev);
3795 error = ops->enable(rdev);
3796 if (error) 3796 if (error)
3797 ret = error; 3797 ret = error;
3798 } else { 3798 } else {