diff options
Diffstat (limited to 'drivers/base/regmap')
-rw-r--r-- | drivers/base/regmap/internal.h | 3 | ||||
-rw-r--r-- | drivers/base/regmap/regmap-debugfs.c | 14 | ||||
-rw-r--r-- | drivers/base/regmap/regmap.c | 4 |
3 files changed, 15 insertions, 6 deletions
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index fcafc5b2e651..6beef6691c47 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h | |||
@@ -41,6 +41,7 @@ struct regmap { | |||
41 | 41 | ||
42 | #ifdef CONFIG_DEBUG_FS | 42 | #ifdef CONFIG_DEBUG_FS |
43 | struct dentry *debugfs; | 43 | struct dentry *debugfs; |
44 | const char *debugfs_name; | ||
44 | #endif | 45 | #endif |
45 | 46 | ||
46 | unsigned int max_register; | 47 | unsigned int max_register; |
@@ -101,7 +102,7 @@ int _regmap_write(struct regmap *map, unsigned int reg, | |||
101 | 102 | ||
102 | #ifdef CONFIG_DEBUG_FS | 103 | #ifdef CONFIG_DEBUG_FS |
103 | extern void regmap_debugfs_initcall(void); | 104 | extern void regmap_debugfs_initcall(void); |
104 | extern void regmap_debugfs_init(struct regmap *map); | 105 | extern void regmap_debugfs_init(struct regmap *map, const char *name); |
105 | extern void regmap_debugfs_exit(struct regmap *map); | 106 | extern void regmap_debugfs_exit(struct regmap *map); |
106 | #else | 107 | #else |
107 | static inline void regmap_debugfs_initcall(void) { } | 108 | static inline void regmap_debugfs_initcall(void) { } |
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 | ||
251 | void regmap_debugfs_init(struct regmap *map) | 251 | void 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) | |||
280 | void regmap_debugfs_exit(struct regmap *map) | 287 | void 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 | ||
285 | void regmap_debugfs_initcall(void) | 293 | void regmap_debugfs_initcall(void) |
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 7a3f535e481c..b1dad1f9c47d 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -289,7 +289,7 @@ struct regmap *regmap_init(struct device *dev, | |||
289 | goto err_map; | 289 | goto err_map; |
290 | } | 290 | } |
291 | 291 | ||
292 | regmap_debugfs_init(map); | 292 | regmap_debugfs_init(map, config->name); |
293 | 293 | ||
294 | ret = regcache_init(map, config); | 294 | ret = regcache_init(map, config); |
295 | if (ret < 0) | 295 | if (ret < 0) |
@@ -372,7 +372,7 @@ int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config) | |||
372 | map->precious_reg = config->precious_reg; | 372 | map->precious_reg = config->precious_reg; |
373 | map->cache_type = config->cache_type; | 373 | map->cache_type = config->cache_type; |
374 | 374 | ||
375 | regmap_debugfs_init(map); | 375 | regmap_debugfs_init(map, config->name); |
376 | 376 | ||
377 | map->cache_bypass = false; | 377 | map->cache_bypass = false; |
378 | map->cache_only = false; | 378 | map->cache_only = false; |