struct snd_soc_dapm_widget *w)
{
int i, ret = 0;
- size_t name_len;
+ size_t name_len, prefix_len;
struct snd_soc_dapm_path *path;
struct snd_card *card = dapm->card->snd_card;
const char *prefix;
else
prefix = NULL;
+ if (prefix)
+ prefix_len = strlen(prefix) + 1;
+ else
+ prefix_len = 0;
+
/* add kcontrol */
for (i = 0; i < w->num_kcontrols; i++) {
switch (w->id) {
default:
+ /* The control will get a prefix from
+ * the control creation process but
+ * we're also using the same prefix
+ * for widgets so cut the prefix off
+ * the front of the widget name.
+ */
snprintf(path->long_name, name_len, "%s %s",
- w->name, w->kcontrols[i].name);
+ w->name + prefix_len,
+ w->kcontrols[i].name);
break;
case snd_soc_dapm_mixer_named_ctl:
snprintf(path->long_name, name_len, "%s",
struct snd_kcontrol *kcontrol;
struct snd_card *card = dapm->card->snd_card;
const char *prefix;
+ size_t prefix_len;
int ret = 0;
if (!w->num_kcontrols) {
else
prefix = NULL;
- kcontrol = snd_soc_cnew(&w->kcontrols[0], w, w->name, prefix);
+ if (prefix)
+ prefix_len = strlen(prefix) + 1;
+ else
+ prefix_len = 0;
+
+ /* The control will get a prefix from the control creation
+ * process but we're also using the same prefix for widgets so
+ * cut the prefix off the front of the widget name.
+ */
+ kcontrol = snd_soc_cnew(&w->kcontrols[0], w, w->name + prefix_len,
+ prefix);
ret = snd_ctl_add(card, kcontrol);
if (ret < 0)