diff options
author | Mark Brown <broonie@kernel.org> | 2017-07-03 11:52:16 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-07-03 11:52:16 -0400 |
commit | fcaa3167b2763d35a7dc60c5724f23e441d29f4f (patch) | |
tree | c3a747d7c71b3e79440091e4c068e9c3da5e965f | |
parent | 85fd19e432b5ed5357d54f1048a088d9eb5aae94 (diff) | |
parent | dbc559554086f176b04f97eec561ad26ee54e47c (diff) |
Merge remote-tracking branch 'regulator/topic/core' into regulator-next
-rw-r--r-- | drivers/regulator/core.c | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 9fecbd4e3546..e9f74331fc69 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -1462,7 +1462,7 @@ static struct regulator_dev *regulator_lookup_by_name(const char *name) | |||
1462 | static struct regulator_dev *regulator_dev_lookup(struct device *dev, | 1462 | static struct regulator_dev *regulator_dev_lookup(struct device *dev, |
1463 | const char *supply) | 1463 | const char *supply) |
1464 | { | 1464 | { |
1465 | struct regulator_dev *r; | 1465 | struct regulator_dev *r = NULL; |
1466 | struct device_node *node; | 1466 | struct device_node *node; |
1467 | struct regulator_map *map; | 1467 | struct regulator_map *map; |
1468 | const char *devname = NULL; | 1468 | const char *devname = NULL; |
@@ -1489,10 +1489,6 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev, | |||
1489 | if (dev) | 1489 | if (dev) |
1490 | devname = dev_name(dev); | 1490 | devname = dev_name(dev); |
1491 | 1491 | ||
1492 | r = regulator_lookup_by_name(supply); | ||
1493 | if (r) | ||
1494 | return r; | ||
1495 | |||
1496 | mutex_lock(®ulator_list_mutex); | 1492 | mutex_lock(®ulator_list_mutex); |
1497 | list_for_each_entry(map, ®ulator_map_list, list) { | 1493 | list_for_each_entry(map, ®ulator_map_list, list) { |
1498 | /* If the mapping has a device set up it must match */ | 1494 | /* If the mapping has a device set up it must match */ |
@@ -1511,6 +1507,10 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev, | |||
1511 | if (r) | 1507 | if (r) |
1512 | return r; | 1508 | return r; |
1513 | 1509 | ||
1510 | r = regulator_lookup_by_name(supply); | ||
1511 | if (r) | ||
1512 | return r; | ||
1513 | |||
1514 | return ERR_PTR(-ENODEV); | 1514 | return ERR_PTR(-ENODEV); |
1515 | } | 1515 | } |
1516 | 1516 | ||
@@ -4312,41 +4312,31 @@ void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data) | |||
4312 | EXPORT_SYMBOL_GPL(regulator_get_init_drvdata); | 4312 | EXPORT_SYMBOL_GPL(regulator_get_init_drvdata); |
4313 | 4313 | ||
4314 | #ifdef CONFIG_DEBUG_FS | 4314 | #ifdef CONFIG_DEBUG_FS |
4315 | static ssize_t supply_map_read_file(struct file *file, char __user *user_buf, | 4315 | static int supply_map_show(struct seq_file *sf, void *data) |
4316 | size_t count, loff_t *ppos) | ||
4317 | { | 4316 | { |
4318 | char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL); | ||
4319 | ssize_t len, ret = 0; | ||
4320 | struct regulator_map *map; | 4317 | struct regulator_map *map; |
4321 | 4318 | ||
4322 | if (!buf) | ||
4323 | return -ENOMEM; | ||
4324 | |||
4325 | list_for_each_entry(map, ®ulator_map_list, list) { | 4319 | list_for_each_entry(map, ®ulator_map_list, list) { |
4326 | len = snprintf(buf + ret, PAGE_SIZE - ret, | 4320 | seq_printf(sf, "%s -> %s.%s\n", |
4327 | "%s -> %s.%s\n", | 4321 | rdev_get_name(map->regulator), map->dev_name, |
4328 | rdev_get_name(map->regulator), map->dev_name, | 4322 | map->supply); |
4329 | map->supply); | ||
4330 | if (len >= 0) | ||
4331 | ret += len; | ||
4332 | if (ret > PAGE_SIZE) { | ||
4333 | ret = PAGE_SIZE; | ||
4334 | break; | ||
4335 | } | ||
4336 | } | 4323 | } |
4337 | 4324 | ||
4338 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); | 4325 | return 0; |
4339 | 4326 | } | |
4340 | kfree(buf); | ||
4341 | 4327 | ||
4342 | return ret; | 4328 | static int supply_map_open(struct inode *inode, struct file *file) |
4329 | { | ||
4330 | return single_open(file, supply_map_show, inode->i_private); | ||
4343 | } | 4331 | } |
4344 | #endif | 4332 | #endif |
4345 | 4333 | ||
4346 | static const struct file_operations supply_map_fops = { | 4334 | static const struct file_operations supply_map_fops = { |
4347 | #ifdef CONFIG_DEBUG_FS | 4335 | #ifdef CONFIG_DEBUG_FS |
4348 | .read = supply_map_read_file, | 4336 | .open = supply_map_open, |
4349 | .llseek = default_llseek, | 4337 | .read = seq_read, |
4338 | .llseek = seq_lseek, | ||
4339 | .release = single_release, | ||
4350 | #endif | 4340 | #endif |
4351 | }; | 4341 | }; |
4352 | 4342 | ||