Skip to contentSkip to conversation

regmap: Append device name in the root debugfs dir

PATCH In review Dimitris Papastamos 2 participants 3 messages Feb 22, 2012

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

PATCH 1/1 regmap: Append device name in the root debugfs dir

---
 drivers/base/regmap/regmap-debugfs.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/base/regmap/regmap-debugfs.c +6 -2
index b3b4b8f..f396246 100644
@@ -179,8 +179,12 @@ static const struct file_operations regmap_access_fops = {
 
 void regmap_debugfs_init(struct regmap *map)
 {
-	map->debugfs = debugfs_create_dir(dev_name(map->dev),
-					  regmap_debugfs_root);
+	char name[64];
+
+	snprintf(name, sizeof(name), "%s-%s",
+		 dev_name(map->dev), map->dev->driver->name);
+
+	map->debugfs = debugfs_create_dir(name, regmap_debugfs_root);
 	if (!map->debugfs) {
 		dev_warn(map->dev, "Failed to create debugfs directory\n");
 		return;
Signature · 1 line
1.7.9.1
#1 lore raw

drivers/base/regmap/regmap-debugfs.c static const struct file_operations regmap_access_fops = { · line 182

Quoted 5 lines · Dimitris Papastamos

void regmap_debugfs_init(struct regmap *map)
{

drivers/base/regmap/regmap-debugfs.c +1 -2
-	map->debugfs = debugfs_create_dir(dev_name(map->dev),
-					  regmap_debugfs_root);
+	char name[64];

That's a magic number, where did it come from?

drivers/base/regmap/regmap-debugfs.c static const struct file_operations regmap_access_fops = { · line 187

Quoted 5 lines
drivers/base/regmap/regmap-debugfs.c +5 -0
+
+	snprintf(name, sizeof(name), "%s-%s",
+		 dev_name(map->dev), map->dev->driver->name);
+
+	map->debugfs = debugfs_create_dir(name, regmap_debugfs_root);

No, keep the directory name the same and add a new file.

#2 lore raw
Quoted 9 lines · Mark Brown

drivers/base/regmap/regmap-debugfs.c static const struct file_operations regmap_access_fops = { · line 182

Quoted 5 lines · Dimitris Papastamos

void regmap_debugfs_init(struct regmap *map)
{

drivers/base/regmap/regmap-debugfs.c +1 -2
-	map->debugfs = debugfs_create_dir(dev_name(map->dev),
-					  regmap_debugfs_root);
+	char name[64];

That's a magic number, where did it come from?

I can try to use something like NAME_MAX I suppose.

Quoted 7 lines

drivers/base/regmap/regmap-debugfs.c static const struct file_operations regmap_access_fops = { · line 187

Quoted 5 lines
drivers/base/regmap/regmap-debugfs.c +5 -0
+
+	snprintf(name, sizeof(name), "%s-%s",
+		 dev_name(map->dev), map->dev->driver->name);
+
+	map->debugfs = debugfs_create_dir(name, regmap_debugfs_root);

No, keep the directory name the same and add a new file.

Right, that was what I had initially implemented but seemed a bit of overkill, but yea I can do that.

Thanks,
Dimitris