Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 272406
b: refs/heads/master
c: ba55a97
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown authored and Liam Girdwood committed Aug 28, 2011
1 parent f666c0b commit 125dc09
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 500c524aad173864a58e128d0be9713fa5846471
refs/heads/master: ba55a9741da6c85176987c15e24383b858749aa2
41 changes: 41 additions & 0 deletions trunk/drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2907,6 +2907,43 @@ void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data)
}
EXPORT_SYMBOL_GPL(regulator_get_init_drvdata);

#ifdef CONFIG_DEBUG_FS
static ssize_t supply_map_read_file(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
ssize_t len, ret = 0;
struct regulator_map *map;

if (!buf)
return -ENOMEM;

list_for_each_entry(map, &regulator_map_list, list) {
len = snprintf(buf + ret, PAGE_SIZE - ret,
"%s -> %s.%s\n",
rdev_get_name(map->regulator), map->dev_name,
map->supply);
if (len >= 0)
ret += len;
if (ret > PAGE_SIZE) {
ret = PAGE_SIZE;
break;
}
}

ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);

kfree(buf);

return ret;
}

static const struct file_operations supply_map_fops = {
.read = supply_map_read_file,
.llseek = default_llseek,
};
#endif

static int __init regulator_init(void)
{
int ret;
Expand All @@ -2919,6 +2956,10 @@ static int __init regulator_init(void)
pr_warn("regulator: Failed to create debugfs directory\n");
debugfs_root = NULL;
}

if (IS_ERR(debugfs_create_file("supply_map", 0444, debugfs_root,
NULL, &supply_map_fops)))
pr_warn("regulator: Failed to create supplies debugfs\n");
#endif

regulator_dummy_init();
Expand Down

0 comments on commit 125dc09

Please sign in to comment.