Commit 8eecaf62 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown

ASoC: Move DAPM debugfs directory creation to snd_soc_dapm_debugfs_init

Move the creation of the DAPM debugfs directory to snd_soc_dapm_debugfs_init
instead of having the same duplicated code in both codec and card DAPM setup.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Acked-by: default avatarLiam Girdwood <lrg@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 0aaae527
...@@ -356,7 +356,8 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card); ...@@ -356,7 +356,8 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card);
/* dapm sys fs - used by the core */ /* dapm sys fs - used by the core */
int snd_soc_dapm_sys_add(struct device *dev); int snd_soc_dapm_sys_add(struct device *dev);
void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm); void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
struct dentry *parent);
/* dapm audio pin control and status */ /* dapm audio pin control and status */
int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm,
......
...@@ -302,13 +302,7 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec) ...@@ -302,13 +302,7 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
printk(KERN_WARNING printk(KERN_WARNING
"ASoC: Failed to create codec register debugfs file\n"); "ASoC: Failed to create codec register debugfs file\n");
codec->dapm.debugfs_dapm = debugfs_create_dir("dapm", snd_soc_dapm_debugfs_init(&codec->dapm, codec->debugfs_codec_root);
codec->debugfs_codec_root);
if (!codec->dapm.debugfs_dapm)
printk(KERN_WARNING
"Failed to create DAPM debugfs directory\n");
snd_soc_dapm_debugfs_init(&codec->dapm);
} }
static void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec) static void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec)
...@@ -1926,13 +1920,7 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) ...@@ -1926,13 +1920,7 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
card->num_dapm_routes); card->num_dapm_routes);
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
card->dapm.debugfs_dapm = debugfs_create_dir("dapm", snd_soc_dapm_debugfs_init(&card->dapm, card->debugfs_card_root);
card->debugfs_card_root);
if (!card->dapm.debugfs_dapm)
printk(KERN_WARNING
"Failed to create card DAPM debugfs directory\n");
snd_soc_dapm_debugfs_init(&card->dapm);
#endif #endif
snprintf(card->snd_card->shortname, sizeof(card->snd_card->shortname), snprintf(card->snd_card->shortname, sizeof(card->snd_card->shortname),
......
...@@ -1254,13 +1254,19 @@ static const struct file_operations dapm_bias_fops = { ...@@ -1254,13 +1254,19 @@ static const struct file_operations dapm_bias_fops = {
.llseek = default_llseek, .llseek = default_llseek,
}; };
void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm) void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
struct dentry *parent)
{ {
struct snd_soc_dapm_widget *w; struct snd_soc_dapm_widget *w;
struct dentry *d; struct dentry *d;
if (!dapm->debugfs_dapm) dapm->debugfs_dapm = debugfs_create_dir("dapm", parent);
if (!dapm->debugfs_dapm) {
printk(KERN_WARNING
"Failed to create DAPM debugfs directory\n");
return; return;
}
d = debugfs_create_file("bias_level", 0444, d = debugfs_create_file("bias_level", 0444,
dapm->debugfs_dapm, dapm, dapm->debugfs_dapm, dapm,
...@@ -1283,7 +1289,8 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm) ...@@ -1283,7 +1289,8 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm)
} }
} }
#else #else
void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm) void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
struct dentry *parent)
{ {
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment