diff options
author | Markus Pargmann <mpa@pengutronix.de> | 2014-02-20 11:36:03 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-02-24 20:31:25 -0500 |
commit | 30c219710358c5cca2f8bd2e9e547c6aadf7cf8b (patch) | |
tree | 9bc91fd18c9f1b6b82a851ab066a39b9ebb76bdd | |
parent | acc3d5cec84f82ebea535fa0bd9500ac3df2aee9 (diff) |
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>
-rw-r--r-- | drivers/regulator/core.c | 14 |
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, | |||
953 | return 0; | 953 | return 0; |
954 | } | 954 | } |
955 | 955 | ||
956 | static int _regulator_do_enable(struct regulator_dev *rdev); | ||
957 | |||
956 | /** | 958 | /** |
957 | * set_machine_constraints - sets regulator constraints | 959 | * set_machine_constraints - sets regulator constraints |
958 | * @rdev: regulator source | 960 | * @rdev: regulator source |
@@ -1013,10 +1015,9 @@ static int set_machine_constraints(struct regulator_dev *rdev, | |||
1013 | /* If the constraints say the regulator should be on at this point | 1015 | /* If the constraints say the regulator should be on at this point |
1014 | * and we have control then make sure it is enabled. | 1016 | * and we have control then make sure it is enabled. |
1015 | */ | 1017 | */ |
1016 | if ((rdev->constraints->always_on || rdev->constraints->boot_on) && | 1018 | if (rdev->constraints->always_on || rdev->constraints->boot_on) { |
1017 | ops->enable) { | 1019 | ret = _regulator_do_enable(rdev); |
1018 | ret = ops->enable(rdev); | 1020 | if (ret < 0 && ret != -EINVAL) { |
1019 | if (ret < 0) { | ||
1020 | rdev_err(rdev, "failed to enable\n"); | 1021 | rdev_err(rdev, "failed to enable\n"); |
1021 | goto out; | 1022 | goto out; |
1022 | } | 1023 | } |
@@ -3626,9 +3627,8 @@ int regulator_suspend_finish(void) | |||
3626 | struct regulator_ops *ops = rdev->desc->ops; | 3627 | struct regulator_ops *ops = rdev->desc->ops; |
3627 | 3628 | ||
3628 | mutex_lock(&rdev->mutex); | 3629 | mutex_lock(&rdev->mutex); |
3629 | if ((rdev->use_count > 0 || rdev->constraints->always_on) && | 3630 | if (rdev->use_count > 0 || rdev->constraints->always_on) { |
3630 | ops->enable) { | 3631 | error = _regulator_do_enable(rdev); |
3631 | error = ops->enable(rdev); | ||
3632 | if (error) | 3632 | if (error) |
3633 | ret = error; | 3633 | ret = error; |
3634 | } else { | 3634 | } else { |