aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/regmap-debugfs.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-04-04 17:48:29 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-10 05:31:41 -0400
commitd3c242e1f22f5dfed009296ee45ce896153f0b53 (patch)
tree074bd0d53a1439e7201639d0acdeeedf5b3f0232 /drivers/base/regmap/regmap-debugfs.c
parentdd775ae2549217d3ae09363e3edb305d0fa19928 (diff)
regmap: allow regmap instances to be named
Some devices have multiple separate register regions. Logically, one regmap would be created per region. One issue that prevents this is that each instance will attempt to create the same debugfs files. Avoid this by allowing regmaps to be named, and use the name to construct the debugfs directory name. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap/regmap-debugfs.c')
-rw-r--r--drivers/base/regmap/regmap-debugfs.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 58517a5dac13..9715e8e44506 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -248,10 +248,17 @@ static const struct file_operations regmap_access_fops = {
248 .llseek = default_llseek, 248 .llseek = default_llseek,
249}; 249};
250 250
251void regmap_debugfs_init(struct regmap *map) 251void regmap_debugfs_init(struct regmap *map, const char *name)
252{ 252{
253 map->debugfs = debugfs_create_dir(dev_name(map->dev), 253 if (name) {
254 regmap_debugfs_root); 254 map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",
255 dev_name(map->dev), name);
256 name = map->debugfs_name;
257 } else {
258 name = dev_name(map->dev);
259 }
260
261 map->debugfs = debugfs_create_dir(name, regmap_debugfs_root);
255 if (!map->debugfs) { 262 if (!map->debugfs) {
256 dev_warn(map->dev, "Failed to create debugfs directory\n"); 263 dev_warn(map->dev, "Failed to create debugfs directory\n");
257 return; 264 return;
@@ -280,6 +287,7 @@ void regmap_debugfs_init(struct regmap *map)
280void regmap_debugfs_exit(struct regmap *map) 287void regmap_debugfs_exit(struct regmap *map)
281{ 288{
282 debugfs_remove_recursive(map->debugfs); 289 debugfs_remove_recursive(map->debugfs);
290 kfree(map->debugfs_name);
283} 291}
284 292
285void regmap_debugfs_initcall(void) 293void regmap_debugfs_initcall(void)