diff options
author | Koro Chen <koro.chen@mediatek.com> | 2015-05-11 10:36:53 +0800 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2015-08-07 00:32:11 +0100 |
commit | b9d2bbcdce078d8b59c45e5e101c13ed1e35b6e8 (patch) | |
tree | 96b04d4a3f7e48c83d3a6af6f6641b00f7f097ce | |
parent | c36b570ffcc2cf8d0de724f24ac9fc99e2f16421 (diff) | |
download | lwn-b9d2bbcdce078d8b59c45e5e101c13ed1e35b6e8.tar.gz lwn-b9d2bbcdce078d8b59c45e5e101c13ed1e35b6e8.zip |
ASoC: dapm: Modify widget stream name according to prefix
commit fdb6eb0a12871d5bfaf266c5a0d5259a5437a72f upstream.
When there is prefix specified, currently we will add this prefix in
widget->name, but not in widget->sname.
it causes failure at snd_soc_dapm_link_dai_widgets:
if (!w->sname || !strstr(w->sname, dai_w->name))
because dai_w->name has prefix added, but w->sname does not.
We should also add prefix for stream name
Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
[bwh: Backported to 3.2:
- Adjust context
- s/prefix/dapm->codec->name_prefix]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | sound/soc/soc-dapm.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 1d83a4039738..3dc1b8af41ab 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -2675,12 +2675,18 @@ int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, kfree(w); return -ENOMEM; } - if (dapm->codec && dapm->codec->name_prefix) + if (dapm->codec && dapm->codec->name_prefix) { snprintf(w->name, name_len, "%s %s", dapm->codec->name_prefix, widget->name); - else + if (widget->sname) + w->sname = kasprintf(GFP_KERNEL, "%s %s", + dapm->codec->name_prefix, + widget->sname); + } else { snprintf(w->name, name_len, "%s", widget->name); - + if (widget->sname) + w->sname = kasprintf(GFP_KERNEL, "%s", widget->sname); + } switch (w->id) { case snd_soc_dapm_switch: case snd_soc_dapm_mixer: |