Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302094
b: refs/heads/master
c: 6d191a5
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Apr 3, 2012
1 parent 033e64b commit c123813
Show file tree
Hide file tree
Showing 2 changed files with 15 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: 01e86f4988297abb403be92bc3b6ad24e1d058de
refs/heads/master: 6d191a5fc7a969d972f1681e1c23781aecb06a61
18 changes: 14 additions & 4 deletions trunk/drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1169,19 +1169,29 @@ static int _regulator_get_enable_time(struct regulator_dev *rdev)
}

static struct regulator_dev *regulator_dev_lookup(struct device *dev,
const char *supply)
const char *supply,
int *ret)
{
struct regulator_dev *r;
struct device_node *node;

/* first do a dt based lookup */
if (dev && dev->of_node) {
node = of_get_regulator(dev, supply);
if (node)
if (node) {
list_for_each_entry(r, &regulator_list, list)
if (r->dev.parent &&
node == r->dev.of_node)
return r;
} else {
/*
* If we couldn't even get the node then it's
* not just that the device didn't register
* yet, there's no node and we'll never
* succeed.
*/
*ret = -ENODEV;
}
}

/* if not found, try doing it non-dt way */
Expand Down Expand Up @@ -1212,7 +1222,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,

mutex_lock(&regulator_list_mutex);

rdev = regulator_dev_lookup(dev, id);
rdev = regulator_dev_lookup(dev, id, &ret);
if (rdev)
goto found;

Expand Down Expand Up @@ -2926,7 +2936,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
if (supply) {
struct regulator_dev *r;

r = regulator_dev_lookup(dev, supply);
r = regulator_dev_lookup(dev, supply, &ret);

if (!r) {
dev_err(dev, "Failed to find supply %s\n", supply);
Expand Down

0 comments on commit c123813

Please sign in to comment.