diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-06-26 15:22:50 +0100 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-06-28 13:45:39 +0100 |
commit | e73f3de5c5eb5285a1b1d8eed111eb229702b20f (patch) | |
tree | 08a88e895b6cb1b9664b71c95b712e67114a755b /sound/soc/soc-core.c | |
parent | 7171511eaec5bf23fb06078f59784a3a0626b38f (diff) | |
download | blackbird-op-linux-e73f3de5c5eb5285a1b1d8eed111eb229702b20f.tar.gz blackbird-op-linux-e73f3de5c5eb5285a1b1d8eed111eb229702b20f.zip |
ASoC: fix debugfs directory creation bug
Avoid creating duplicate directories by prefixing codecs and platforms
with their separate identifiers. This avoids snd-soc-dummy (which can
appear both as a dummy platform and a dummy codec on the same card)
from clashing.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r-- | sound/soc/soc-core.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b87d7d882e6d..91120b8e283e 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -270,12 +270,32 @@ static const struct file_operations codec_reg_fops = { .llseek = default_llseek, }; +static struct dentry *soc_debugfs_create_dir(struct dentry *parent, + const char *fmt, ...) +{ + struct dentry *de; + va_list ap; + char *s; + + va_start(ap, fmt); + s = kvasprintf(GFP_KERNEL, fmt, ap); + va_end(ap); + + if (!s) + return NULL; + + de = debugfs_create_dir(s, parent); + kfree(s); + + return de; +} + static void soc_init_codec_debugfs(struct snd_soc_codec *codec) { struct dentry *debugfs_card_root = codec->card->debugfs_card_root; - codec->debugfs_codec_root = debugfs_create_dir(codec->name, - debugfs_card_root); + codec->debugfs_codec_root = soc_debugfs_create_dir(debugfs_card_root, + "codec:%s", codec->name); if (!codec->debugfs_codec_root) { dev_warn(codec->dev, "ASoC: Failed to create codec debugfs directory\n"); @@ -306,8 +326,8 @@ static void soc_init_platform_debugfs(struct snd_soc_platform *platform) { struct dentry *debugfs_card_root = platform->card->debugfs_card_root; - platform->debugfs_platform_root = debugfs_create_dir(platform->name, - debugfs_card_root); + platform->debugfs_platform_root = soc_debugfs_create_dir(debugfs_card_root, + "platform:%s", platform->name); if (!platform->debugfs_platform_root) { dev_warn(platform->dev, "ASoC: Failed to create platform debugfs directory\n"); |