Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302095
b: refs/heads/master
c: 576ca43
h: refs/heads/master
i:
  302093: 033e64b
  302091: 07e65dc
  302087: c31d61a
  302079: efcea51
v: v3
  • Loading branch information
Mark Brown committed Apr 3, 2012
1 parent c123813 commit 1aca4ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 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: 6d191a5fc7a969d972f1681e1c23781aecb06a61
refs/heads/master: 576ca4367f291a9b240d027670fa2e344edf8c8a
29 changes: 16 additions & 13 deletions trunk/drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,8 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev,
{
struct regulator_dev *r;
struct device_node *node;
struct regulator_map *map;
const char *devname = NULL;

/* first do a dt based lookup */
if (dev && dev->of_node) {
Expand All @@ -1195,10 +1197,24 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev,
}

/* if not found, try doing it non-dt way */
if (dev)
devname = dev_name(dev);

list_for_each_entry(r, &regulator_list, list)
if (strcmp(rdev_get_name(r), supply) == 0)
return r;

list_for_each_entry(map, &regulator_map_list, list) {
/* If the mapping has a device set up it must match */
if (map->dev_name &&
(!devname || strcmp(map->dev_name, devname)))
continue;

if (strcmp(map->supply, supply) == 0)
return map->regulator;
}


return NULL;
}

Expand All @@ -1207,7 +1223,6 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
int exclusive)
{
struct regulator_dev *rdev;
struct regulator_map *map;
struct regulator *regulator = ERR_PTR(-EPROBE_DEFER);
const char *devname = NULL;
int ret;
Expand All @@ -1226,18 +1241,6 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
if (rdev)
goto found;

list_for_each_entry(map, &regulator_map_list, list) {
/* If the mapping has a device set up it must match */
if (map->dev_name &&
(!devname || strcmp(map->dev_name, devname)))
continue;

if (strcmp(map->supply, id) == 0) {
rdev = map->regulator;
goto found;
}
}

if (board_wants_dummy_regulator) {
rdev = dummy_regulator_rdev;
goto found;
Expand Down

0 comments on commit 1aca4ed

Please sign in to comment.