summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2012-01-25 12:35:38 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-25 11:55:44 +0000
commit49e226323d462785582750d9f38acca5ffa5dd48 (patch)
treececbd7af1653230d9d29c3b071d546a44b74d9fe /drivers/regulator/core.c
parentdcd6c92267155e70a94b3927bce681ce74b80d1f (diff)
downloadblackbird-op-linux-49e226323d462785582750d9f38acca5ffa5dd48.tar.gz
blackbird-op-linux-49e226323d462785582750d9f38acca5ffa5dd48.zip
regulator: Reverse the disable sequence in regulator_bulk_disable()
Often there is a need for disabling a set of regulators in order opposite to the enable order. Currently the function regulator_bulk_disable() walks list of regulators in same order as regulator_bulk_enable(). This may cause trouble, especially for devices with mixed analogue and digital circuits. So reverse the disabling sequence of regulator_bulk_disable(). While at it, also correct the comment. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index ca86f39a0fdc..daba2f60f7d9 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2463,8 +2463,8 @@ EXPORT_SYMBOL_GPL(regulator_bulk_enable);
* @return 0 on success, an errno on failure
*
* This convenience API allows consumers to disable multiple regulator
- * clients in a single API call. If any consumers cannot be enabled
- * then any others that were disabled will be disabled again prior to
+ * clients in a single API call. If any consumers cannot be disabled
+ * then any others that were disabled will be enabled again prior to
* return.
*/
int regulator_bulk_disable(int num_consumers,
@@ -2473,7 +2473,7 @@ int regulator_bulk_disable(int num_consumers,
int i;
int ret;
- for (i = 0; i < num_consumers; i++) {
+ for (i = num_consumers - 1; i >= 0; --i) {
ret = regulator_disable(consumers[i].consumer);
if (ret != 0)
goto err;
@@ -2483,7 +2483,7 @@ int regulator_bulk_disable(int num_consumers,
err:
pr_err("Failed to disable %s: %d\n", consumers[i].supply, ret);
- for (--i; i >= 0; --i)
+ for (++i; i < num_consumers; ++i)
regulator_enable(consumers[i].consumer);
return ret;
OpenPOWER on IntegriCloud