Skip to contentSkip to conversation

ASoC: fsl_ssi: Do not create debugfs directory

PATCH In review Fabio Estevam 3 participants 3 messages Apr 8, 2015 – Apr 9, 2015

Subsystems (3)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH v2 1/1 ASoC: fsl_ssi: Do not create debugfs directory

From: Fabio Estevam <[email protected]>

Since commit 81c7cfd1b22a0 ("ASoC: Move debugfs registration to the component level") ASoC core code deals with registering debugfs, so we should not be creating the debugfs directory locally in order to avoid the following warning:

fsl-ssi-dai 2028000.ssi: ASoC: Failed to create component debugfs directory

---
Changes since v1:
- Only remove dir creation/remove as suggested by Mark Brown

 sound/soc/fsl/fsl_ssi.h     |  1 -
 sound/soc/fsl/fsl_ssi_dbg.c | 13 +++----------
 2 files changed, 3 insertions(+), 11 deletions(-)
sound/soc/fsl/fsl_ssi.h +0 -1
index 5065105..68aef90 100644
@@ -211,7 +211,6 @@ struct device;
 #if IS_ENABLED(CONFIG_DEBUG_FS)
 
 struct fsl_ssi_dbg {
-	struct dentry *dbg_dir;
 	struct dentry *dbg_stats;
 
 	struct {
sound/soc/fsl/fsl_ssi_dbg.c +3 -10
index 5469ffb..46cea84 100644
@@ -142,22 +142,15 @@ static const struct file_operations fsl_ssi_stats_ops = {
 
 int fsl_ssi_debugfs_create(struct fsl_ssi_dbg *ssi_dbg, struct device *dev)
 {
-	ssi_dbg->dbg_dir = debugfs_create_dir(dev_name(dev), NULL);
-	if (!ssi_dbg->dbg_dir)
+	ssi_dbg->dbg_stats = debugfs_create_file("stats", S_IRUGO, NULL,
+						 ssi_dbg, &fsl_ssi_stats_ops);
+	if (!ssi_dbg->dbg_stats)
 		return -ENOMEM;
 
-	ssi_dbg->dbg_stats = debugfs_create_file("stats", S_IRUGO,
-			ssi_dbg->dbg_dir, ssi_dbg, &fsl_ssi_stats_ops);
-	if (!ssi_dbg->dbg_stats) {
-		debugfs_remove(ssi_dbg->dbg_dir);
-		return -ENOMEM;
-	}
-
 	return 0;
 }
 
 void fsl_ssi_debugfs_remove(struct fsl_ssi_dbg *ssi_dbg)
 {
 	debugfs_remove(ssi_dbg->dbg_stats);
-	debugfs_remove(ssi_dbg->dbg_dir);
 }
Signature · 1 line
1.9.1
reviewer
#1 lore raw
Quoted 21 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Since commit 81c7cfd1b22a0 ("ASoC: Move debugfs registration to the component level") ASoC core code deals with registering debugfs, so we should not be creating the debugfs directory locally in order to avoid the following warning:

fsl-ssi-dai 2028000.ssi: ASoC: Failed to create component debugfs directory

---
Changes since v1:
- Only remove dir creation/remove as suggested by Mark Brown

sound/soc/fsl/fsl_ssi_dbg.c +0 -0
index 5469ffb..46cea84 100644
@@ -142,22 +142,15 @@ static const struct file_operations fsl_ssi_stats_ops = {
 
 int fsl_ssi_debugfs_create(struct fsl_ssi_dbg *ssi_dbg, struct device *dev)

sound/soc/fsl/fsl_ssi_dbg.c static const struct file_operations fsl_ssi_stats_ops = { · line 150

Quoted 10 lines
sound/soc/fsl/fsl_ssi_dbg.c +3 -4
 {
-	ssi_dbg->dbg_dir = debugfs_create_dir(dev_name(dev), NULL);
-	if (!ssi_dbg->dbg_dir)
+	ssi_dbg->dbg_stats = debugfs_create_file("stats", S_IRUGO, NULL,
+						 ssi_dbg, &fsl_ssi_stats_ops);
+	if (!ssi_dbg->dbg_stats)
 		return -ENOMEM;
 
-	ssi_dbg->dbg_stats = debugfs_create_file("stats", S_IRUGO,
-			ssi_dbg->dbg_dir, ssi_dbg, &fsl_ssi_stats_ops);

It seems that dropping the dbg_dir and using NULL will make the stats become an orphan inside the debugfs. I am wondering if we can get the dbg_dir from the component so as to put this stats under the directory of SSIn as before.

Nicolin

#2 lore raw
Quoted 30 lines · Nicolin Chen
Quoted 29 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Since commit 81c7cfd1b22a0 ("ASoC: Move debugfs registration to the component level") ASoC core code deals with registering debugfs, so we should not be creating the debugfs directory locally in order to avoid the following warning:

fsl-ssi-dai 2028000.ssi: ASoC: Failed to create component debugfs directory

---
Changes since v1:
- Only remove dir creation/remove as suggested by Mark Brown

sound/soc/fsl/fsl_ssi_dbg.c +3 -2
index 5469ffb..46cea84 100644
@@ -142,22 +142,15 @@ static const struct file_operations fsl_ssi_stats_ops = {
 
  int fsl_ssi_debugfs_create(struct fsl_ssi_dbg *ssi_dbg, struct device *dev)
  {
-	ssi_dbg->dbg_dir = debugfs_create_dir(dev_name(dev), NULL);
-	if (!ssi_dbg->dbg_dir)
+	ssi_dbg->dbg_stats = debugfs_create_file("stats", S_IRUGO, NULL,
+						 ssi_dbg, &fsl_ssi_stats_ops);
+	if (!ssi_dbg->dbg_stats)
  		return -ENOMEM;
 
Quoted 7 lines

sound/soc/fsl/fsl_ssi_dbg.c static const struct file_operations fsl_ssi_stats_ops = { · line 150

Quoted 2 lines
sound/soc/fsl/fsl_ssi_dbg.c +0 -2
-	ssi_dbg->dbg_stats = debugfs_create_file("stats", S_IRUGO,
-			ssi_dbg->dbg_dir, ssi_dbg, &fsl_ssi_stats_ops);

It seems that dropping the dbg_dir and using NULL will make the stats become an orphan inside the debugfs. I am wondering if we can get the dbg_dir from the component so as to put this stats under the directory of SSIn as before.

That would be the right thing I guess. But the original code registers a top-level debugfs directory with the name of the device. Whereas the debugfs directory for the component is created in asoc/CARD_NAME/. I don't see how these two could collide? I think the patch is trying to fix the wrong thing, the issue for the collision is something else.

- Lars