Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323341
b: refs/heads/master
c: 4e1d67e
h: refs/heads/master
i:
  323339: 5edc431
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Aug 28, 2012
1 parent 39d82d1 commit aa2f02f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 73f4f3d37604ff7084e6157745610c8fb07d27b6
refs/heads/master: 4e1d67eddf70f815b77af5354aaa5e60084fde8b
18 changes: 8 additions & 10 deletions trunk/drivers/regulator/lp872x.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ static int lp8725_buck_set_current_limit(struct regulator_dev *rdev,
{
struct lp872x *lp = rdev_get_drvdata(rdev);
enum lp872x_regulator_id buck = rdev_get_id(rdev);
int i, max = ARRAY_SIZE(lp8725_buck_uA);
u8 addr, val;
int i;
u8 addr;

switch (buck) {
case LP8725_ID_BUCK1:
Expand All @@ -388,17 +388,15 @@ static int lp8725_buck_set_current_limit(struct regulator_dev *rdev,
return -EINVAL;
}

for (i = 0 ; i < max ; i++)
for (i = ARRAY_SIZE(lp8725_buck_uA) - 1 ; i >= 0; i--) {
if (lp8725_buck_uA[i] >= min_uA &&
lp8725_buck_uA[i] <= max_uA)
break;

if (i == max)
return -EINVAL;

val = i << LP8725_BUCK_CL_S;
return lp872x_update_bits(lp, addr,
LP8725_BUCK_CL_M,
i << LP8725_BUCK_CL_S);
}

return lp872x_update_bits(lp, addr, LP8725_BUCK_CL_M, val);
return -EINVAL;
}

static int lp8725_buck_get_current_limit(struct regulator_dev *rdev)
Expand Down

0 comments on commit aa2f02f

Please sign in to comment.