summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2012-08-03 16:41:18 +0530
committerSimone Willett <swillett@nvidia.com>2012-08-03 14:04:37 -0700
commite926e7fd710e726bc5db4783f076decb8de0b9b6 (patch)
tree51877d4a47a0877fac308c6cd2cc0b87b934d714 /drivers/regulator
parent0152207915890487add41f2178a72bfce4251738 (diff)
regulator: core: support of supply name through desc
Add support of providing the supply name through regualtor descriptor. This help to fill the supply name in device based on datasheet. This patch help to develop driver which is align with mainline. This change is small set of change in mainline --------------- commit 69511a452e6dc6b74fe4f3671a51b1b44b9c57e3 Author: Rajendra Nayak <rnayak@ti.com> regulator: map consumer regulator based on device tree --------------- Change-Id: Ia3112f29efe4f0e0c9e98f2b7943255b2eae4c49 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/120883
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index cbe36b93639b..26f8776f8eee 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2654,6 +2654,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
static atomic_t regulator_no = ATOMIC_INIT(0);
struct regulator_dev *rdev;
int ret, i;
+ const char *supply = NULL;
if (regulator_desc == NULL)
return ERR_PTR(-EINVAL);
@@ -2728,21 +2729,24 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
if (ret < 0)
goto scrub;
- if (init_data->supply_regulator) {
+ if (init_data->supply_regulator)
+ supply = init_data->supply_regulator;
+ else if (regulator_desc->supply_name)
+ supply = regulator_desc->supply_name;
+
+ if (supply) {
struct regulator_dev *r;
int found = 0;
list_for_each_entry(r, &regulator_list, list) {
- if (strcmp(rdev_get_name(r),
- init_data->supply_regulator) == 0) {
+ if (strcmp(rdev_get_name(r), supply) == 0) {
found = 1;
break;
}
}
if (!found) {
- dev_err(dev, "Failed to find supply %s\n",
- init_data->supply_regulator);
+ dev_err(dev, "Failed to find supply %s\n", supply);
ret = -ENODEV;
goto scrub;
}