diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/regmap/regmap-debugfs.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index bb1ff175b962..25b6843d6a41 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c | |||
@@ -56,15 +56,15 @@ static const struct file_operations regmap_name_fops = { | |||
56 | .llseek = default_llseek, | 56 | .llseek = default_llseek, |
57 | }; | 57 | }; |
58 | 58 | ||
59 | static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf, | 59 | static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from, |
60 | size_t count, loff_t *ppos) | 60 | unsigned int to, char __user *user_buf, |
61 | size_t count, loff_t *ppos) | ||
61 | { | 62 | { |
62 | int reg_len, val_len, tot_len; | 63 | int reg_len, val_len, tot_len; |
63 | size_t buf_pos = 0; | 64 | size_t buf_pos = 0; |
64 | loff_t p = 0; | 65 | loff_t p = 0; |
65 | ssize_t ret; | 66 | ssize_t ret; |
66 | int i; | 67 | int i; |
67 | struct regmap *map = file->private_data; | ||
68 | char *buf; | 68 | char *buf; |
69 | unsigned int val; | 69 | unsigned int val; |
70 | 70 | ||
@@ -80,7 +80,7 @@ static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf, | |||
80 | val_len = 2 * map->format.val_bytes; | 80 | val_len = 2 * map->format.val_bytes; |
81 | tot_len = reg_len + val_len + 3; /* : \n */ | 81 | tot_len = reg_len + val_len + 3; /* : \n */ |
82 | 82 | ||
83 | for (i = 0; i <= map->max_register; i += map->reg_stride) { | 83 | for (i = from; i <= to; i += map->reg_stride) { |
84 | if (!regmap_readable(map, i)) | 84 | if (!regmap_readable(map, i)) |
85 | continue; | 85 | continue; |
86 | 86 | ||
@@ -95,7 +95,7 @@ static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf, | |||
95 | 95 | ||
96 | /* Format the register */ | 96 | /* Format the register */ |
97 | snprintf(buf + buf_pos, count - buf_pos, "%.*x: ", | 97 | snprintf(buf + buf_pos, count - buf_pos, "%.*x: ", |
98 | reg_len, i); | 98 | reg_len, i - from); |
99 | buf_pos += reg_len + 2; | 99 | buf_pos += reg_len + 2; |
100 | 100 | ||
101 | /* Format the value, write all X if we can't read */ | 101 | /* Format the value, write all X if we can't read */ |
@@ -126,6 +126,15 @@ out: | |||
126 | return ret; | 126 | return ret; |
127 | } | 127 | } |
128 | 128 | ||
129 | static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf, | ||
130 | size_t count, loff_t *ppos) | ||
131 | { | ||
132 | struct regmap *map = file->private_data; | ||
133 | |||
134 | return regmap_read_debugfs(map, 0, map->max_register, user_buf, | ||
135 | count, ppos); | ||
136 | } | ||
137 | |||
129 | #undef REGMAP_ALLOW_WRITE_DEBUGFS | 138 | #undef REGMAP_ALLOW_WRITE_DEBUGFS |
130 | #ifdef REGMAP_ALLOW_WRITE_DEBUGFS | 139 | #ifdef REGMAP_ALLOW_WRITE_DEBUGFS |
131 | /* | 140 | /* |