Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302112
b: refs/heads/master
c: 4dbd8f6
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Apr 1, 2012
1 parent 8ca496a commit 2264955
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 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: 9d442061da08e679ec8e7c004fd0450e799a2af7
refs/heads/master: 4dbd8f63f07a9e945f053d61d6f313ad98dda39d
8 changes: 4 additions & 4 deletions trunk/drivers/regulator/gpio-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ static int gpio_regulator_set_value(struct regulator_dev *dev,
int min, int max)
{
struct gpio_regulator_data *data = rdev_get_drvdata(dev);
int ptr, target, state;
int ptr, target, state, best_val = INT_MAX;

target = -1;
for (ptr = 0; ptr < data->nr_states; ptr++)
if (data->states[ptr].value >= min &&
if (data->states[ptr].value < best_val &&
data->states[ptr].value >= min &&
data->states[ptr].value <= max)
target = data->states[ptr].gpios;

if (target < 0)
if (best_val == INT_MAX)
return -EINVAL;

for (ptr = 0; ptr < data->nr_gpios; ptr++) {
Expand Down

0 comments on commit 2264955

Please sign in to comment.