summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMarkus Pargmann <mpa@pengutronix.de>2014-02-20 17:36:03 +0100
committerMark Brown <broonie@linaro.org>2014-02-25 10:31:25 +0900
commit30c219710358c5cca2f8bd2e9e547c6aadf7cf8b (patch)
tree9bc91fd18c9f1b6b82a851ab066a39b9ebb76bdd /drivers/regulator
parentacc3d5cec84f82ebea535fa0bd9500ac3df2aee9 (diff)
downloadlinux-stable-30c219710358c5cca2f8bd2e9e547c6aadf7cf8b.tar.gz
linux-stable-30c219710358c5cca2f8bd2e9e547c6aadf7cf8b.tar.bz2
linux-stable-30c219710358c5cca2f8bd2e9e547c6aadf7cf8b.zip
regulator: core: Replace direct ops->enable usage
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] Cc: <stable@vger.kernel.org> # 3.10+ Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Mark Brown <broonie@linaro.org> regulator: Handle invalid enable operation for always/boot on regulators Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator')
-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 74e9fb2e52e7..00feec321e3c 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -953,6 +953,8 @@ static int machine_constraints_current(struct regulator_dev *rdev,
return 0;
}
+static int _regulator_do_enable(struct regulator_dev *rdev);
+
/**
* set_machine_constraints - sets regulator constraints
* @rdev: regulator source
@@ -1013,10 +1015,9 @@ static int set_machine_constraints(struct regulator_dev *rdev,
/* If the constraints say the regulator should be on at this point
* and we have control then make sure it is enabled.
*/
- if ((rdev->constraints->always_on || rdev->constraints->boot_on) &&
- ops->enable) {
- ret = ops->enable(rdev);
- if (ret < 0) {
+ if (rdev->constraints->always_on || rdev->constraints->boot_on) {
+ ret = _regulator_do_enable(rdev);
+ if (ret < 0 && ret != -EINVAL) {
rdev_err(rdev, "failed to enable\n");
goto out;
}
@@ -3626,9 +3627,8 @@ int regulator_suspend_finish(void)
struct regulator_ops *ops = rdev->desc->ops;
mutex_lock(&rdev->mutex);
- if ((rdev->use_count > 0 || rdev->constraints->always_on) &&
- ops->enable) {
- error = ops->enable(rdev);
+ if (rdev->use_count > 0 || rdev->constraints->always_on) {
+ error = _regulator_do_enable(rdev);
if (error)
ret = error;
} else {