aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-10-28 09:02:31 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2008-10-30 10:34:03 -0400
commit219b93f5252086c8c8d647c77fc9e1377aab0c8d (patch)
tree844eb83f3ca3983164357f063b777f60b7c580a1
parentf24368c2fb524e911b831b86b5f0acfb38c70317 (diff)
ASoC: Remove DAPM restriction on mixer control name lengths
As well as ensuring that UI-relevant parts of control names don't get truncated in the DAPM code this avoids conflicts in long control names that differ only at the end of a long string. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/soc-dapm.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index b51d82285be4..407092c226f9 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -289,7 +289,7 @@ static int dapm_new_mixer(struct snd_soc_codec *codec,
289 struct snd_soc_dapm_widget *w) 289 struct snd_soc_dapm_widget *w)
290{ 290{
291 int i, ret = 0; 291 int i, ret = 0;
292 char name[32]; 292 size_t name_len;
293 struct snd_soc_dapm_path *path; 293 struct snd_soc_dapm_path *path;
294 294
295 /* add kcontrol */ 295 /* add kcontrol */
@@ -303,11 +303,16 @@ static int dapm_new_mixer(struct snd_soc_codec *codec,
303 continue; 303 continue;
304 304
305 /* add dapm control with long name */ 305 /* add dapm control with long name */
306 snprintf(name, 32, "%s %s", w->name, w->kcontrols[i].name); 306 name_len = 2 + strlen(w->name)
307 path->long_name = kstrdup (name, GFP_KERNEL); 307 + strlen(w->kcontrols[i].name);
308 path->long_name = kmalloc(name_len, GFP_KERNEL);
308 if (path->long_name == NULL) 309 if (path->long_name == NULL)
309 return -ENOMEM; 310 return -ENOMEM;
310 311
312 snprintf(path->long_name, name_len, "%s %s",
313 w->name, w->kcontrols[i].name);
314 path->long_name[name_len - 1] = '\0';
315
311 path->kcontrol = snd_soc_cnew(&w->kcontrols[i], w, 316 path->kcontrol = snd_soc_cnew(&w->kcontrols[i], w,
312 path->long_name); 317 path->long_name);
313 ret = snd_ctl_add(codec->card, path->kcontrol); 318 ret = snd_ctl_add(codec->card, path->kcontrol);