未验证 提交 a430ab20 编写于 作者: F Fabio Estevam 提交者: Mark Brown

regmap: debugfs: Disambiguate dummy debugfs file name

Since commit 9b947a13 ("regmap: use debugfs even when no device")
allows the usage of regmap debugfs even when there is no device
associated, which causes several warnings like this:

(NULL device *): Failed to create debugfs directory

This happens when the debugfs file name is 'dummy'.

The first dummy debugfs creation works fine, but subsequent creations
fail as they have all the same name.

Disambiguate the 'dummy' debugfs file name by adding a suffix entry,
so that the names become dummy0, dummy1, dummy2, etc.
Signed-off-by: NFabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 9b947a13
...@@ -25,6 +25,7 @@ struct regmap_debugfs_node { ...@@ -25,6 +25,7 @@ struct regmap_debugfs_node {
struct list_head link; struct list_head link;
}; };
static unsigned int dummy_index;
static struct dentry *regmap_debugfs_root; static struct dentry *regmap_debugfs_root;
static LIST_HEAD(regmap_debugfs_early_list); static LIST_HEAD(regmap_debugfs_early_list);
static DEFINE_MUTEX(regmap_debugfs_early_lock); static DEFINE_MUTEX(regmap_debugfs_early_lock);
...@@ -573,6 +574,11 @@ void regmap_debugfs_init(struct regmap *map, const char *name) ...@@ -573,6 +574,11 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
name = devname; name = devname;
} }
if (!strcmp(name, "dummy")) {
name = kasprintf(GFP_KERNEL, "dummy%d", dummy_index);
dummy_index++;
}
map->debugfs = debugfs_create_dir(name, regmap_debugfs_root); map->debugfs = debugfs_create_dir(name, regmap_debugfs_root);
if (!map->debugfs) { if (!map->debugfs) {
dev_warn(map->dev, "Failed to create debugfs directory\n"); dev_warn(map->dev, "Failed to create debugfs directory\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册