aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/tps6524x-regulator.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/tps6524x-regulator.c')
-rw-r--r--drivers/regulator/tps6524x-regulator.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c
index 947ece933d90..058d2f2675e9 100644
--- a/drivers/regulator/tps6524x-regulator.c
+++ b/drivers/regulator/tps6524x-regulator.c
@@ -502,15 +502,13 @@ static int set_current_limit(struct regulator_dev *rdev, int min_uA,
502 if (info->n_ilimsels == 1) 502 if (info->n_ilimsels == 1)
503 return -EINVAL; 503 return -EINVAL;
504 504
505 for (i = 0; i < info->n_ilimsels; i++) 505 for (i = info->n_ilimsels - 1; i >= 0; i--) {
506 if (min_uA <= info->ilimsels[i] && 506 if (min_uA <= info->ilimsels[i] &&
507 max_uA >= info->ilimsels[i]) 507 max_uA >= info->ilimsels[i])
508 break; 508 return write_field(hw, &info->ilimsel, i);
509 509 }
510 if (i >= info->n_ilimsels)
511 return -EINVAL;
512 510
513 return write_field(hw, &info->ilimsel, i); 511 return -EINVAL;
514} 512}
515 513
516static int get_current_limit(struct regulator_dev *rdev) 514static int get_current_limit(struct regulator_dev *rdev)