summaryrefslogtreecommitdiff
path: root/sound/core/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/init.c')
-rw-r--r--sound/core/init.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index 56834febc7a4..d4e78b176793 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -13,6 +13,7 @@
#include <linux/time.h>
#include <linux/ctype.h>
#include <linux/pm.h>
+#include <linux/debugfs.h>
#include <linux/completion.h>
#include <sound/core.h>
@@ -161,6 +162,9 @@ int snd_card_new(struct device *parent, int idx, const char *xid,
{
struct snd_card *card;
int err;
+#ifdef CONFIG_SND_DEBUG
+ char name[8];
+#endif
if (snd_BUG_ON(!card_ret))
return -EINVAL;
@@ -244,6 +248,12 @@ int snd_card_new(struct device *parent, int idx, const char *xid,
dev_err(parent, "unable to create card info\n");
goto __error_ctl;
}
+
+#ifdef CONFIG_SND_DEBUG
+ sprintf(name, "card%d", idx);
+ card->debugfs_root = debugfs_create_dir(name, sound_debugfs_root);
+#endif
+
*card_ret = card;
return 0;
@@ -526,6 +536,12 @@ int snd_card_free(struct snd_card *card)
return ret;
/* wait, until all devices are ready for the free operation */
wait_for_completion(&released);
+
+#ifdef CONFIG_SND_DEBUG
+ debugfs_remove(card->debugfs_root);
+ card->debugfs_root = NULL;
+#endif
+
return 0;
}
EXPORT_SYMBOL(snd_card_free);