Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294148
b: refs/heads/master
c: f0c2319
h: refs/heads/master
v: v3
  • Loading branch information
Dimitris Papastamos authored and Mark Brown committed Feb 22, 2012
1 parent f0c51da commit ac3fee1
Show file tree
Hide file tree
Showing 2 changed files with 33 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: 09c6ecd394105c4864a0e409e181c9b1578c2a63
refs/heads/master: f0c2319f9f196726ebe4d7508fd8fbd804988db3
32 changes: 32 additions & 0 deletions trunk/drivers/base/regmap/regmap-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,35 @@ static int regmap_open_file(struct inode *inode, struct file *file)
return 0;
}

static ssize_t regmap_name_read_file(struct file *file,
char __user *user_buf, size_t count,
loff_t *ppos)
{
struct regmap *map = file->private_data;
int ret;
char *buf;

buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!buf)
return -ENOMEM;

ret = snprintf(buf, PAGE_SIZE, "%s\n", map->dev->driver->name);
if (ret < 0) {
kfree(buf);
return ret;
}

ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
kfree(buf);
return ret;
}

static const struct file_operations regmap_name_fops = {
.open = regmap_open_file,
.read = regmap_name_read_file,
.llseek = default_llseek,
};

static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
Expand Down Expand Up @@ -228,6 +257,9 @@ void regmap_debugfs_init(struct regmap *map)
return;
}

debugfs_create_file("name", 0400, map->debugfs,
map, &regmap_name_fops);

if (map->max_register) {
debugfs_create_file("registers", 0400, map->debugfs,
map, &regmap_map_fops);
Expand Down

0 comments on commit ac3fee1

Please sign in to comment.