Skip to contentSkip to conversation

regmap: debugfs: Do not print warning when no device is associated

PATCH In review Fabio Estevam 2 participants 3 messages Mar 2, 2018 – Mar 5, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regmap: debugfs: Do not print warning when no device is associated

From: Fabio Estevam <[email protected]>

Commit 9b947a13e7f6 ("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

Do not print the warning in the case there is no associated device.

---
 drivers/base/regmap/regmap-debugfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/base/regmap/regmap-debugfs.c +3 -1
index 7eb512b..db6141f 100644
@@ -575,7 +575,9 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
 
 	map->debugfs = debugfs_create_dir(name, regmap_debugfs_root);
 	if (!map->debugfs) {
-		dev_warn(map->dev, "Failed to create debugfs directory\n");
+		if (map->dev)
+			dev_warn(map->dev,
+				 "Failed to create debugfs directory\n");
 		return;
 	}
 
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 10 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Commit 9b947a13e7f6 ("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

Do not print the warning in the case there is no associated device.

drivers/base/regmap/regmap-debugfs.c void regmap_debugfs_init(struct regmap *map, const char *name) · line 580

Quoted 6 lines
drivers/base/regmap/regmap-debugfs.c +3 -1
 	map->debugfs = debugfs_create_dir(name, regmap_debugfs_root);
 	if (!map->debugfs) {
-		dev_warn(map->dev, "Failed to create debugfs directory\n");
+		if (map->dev)
+			dev_warn(map->dev,
+				 "Failed to create debugfs directory\n");

This then means that we will just randomly not create a debugfs for anything except the first device that tries to do so with no device which doesn't seem right. We should try harder to create a name here, for example we could try printing the pointer to the map. Or keep a counter and use dummy0 and so on.

#2 lore raw

Hi Mark,

Quoted 5 lines · Mark Brown

This then means that we will just randomly not create a debugfs for anything except the first device that tries to do so with no device which doesn't seem right. We should try harder to create a name here, for example we could try printing the pointer to the map. Or keep a counter and use dummy0 and so on.

Tried your second suggestion of creating dummy0, dummy1, dummy2, etc and it worked here.

Will send a v2 shortly.

Thanks