From 1aca4ed733b20d2395bb1f27c0b9e4fbf4920916 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 30 Mar 2012 12:24:37 +0100 Subject: [PATCH] --- yaml --- r: 302095 b: refs/heads/master c: 576ca4367f291a9b240d027670fa2e344edf8c8a h: refs/heads/master i: 302093: 033e64bee1463b923743a5ad75c1af376a465aa0 302091: 07e65dcf834e400d7f7f30b21d66b7f4ab41cec3 302087: c31d61a8c8a48da763d006189893cd7ef926568c 302079: efcea516635255e6beecec5423d8abc36a23fe79 v: v3 --- [refs] | 2 +- trunk/drivers/regulator/core.c | 29 ++++++++++++++++------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/[refs] b/[refs] index 498a8254363f..e15a7036fd5f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6d191a5fc7a969d972f1681e1c23781aecb06a61 +refs/heads/master: 576ca4367f291a9b240d027670fa2e344edf8c8a diff --git a/trunk/drivers/regulator/core.c b/trunk/drivers/regulator/core.c index 7b11979d79d1..f032823caa98 100644 --- a/trunk/drivers/regulator/core.c +++ b/trunk/drivers/regulator/core.c @@ -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) { @@ -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, ®ulator_list, list) if (strcmp(rdev_get_name(r), supply) == 0) return r; + list_for_each_entry(map, ®ulator_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; } @@ -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; @@ -1226,18 +1241,6 @@ static struct regulator *_regulator_get(struct device *dev, const char *id, if (rdev) goto found; - list_for_each_entry(map, ®ulator_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;