static int parse_text_values(snd_config_t *cfg, struct tplg_elem *elem) { struct tplg_texts *texts = elem->texts; snd_config_iterator_t i, next; snd_config_t *n; const char *value = NULL; int j = 0; tplg_dbg(" Text Values: %s\n", elem->id); snd_config_for_each(i, next, cfg) { n = snd_config_iterator_entry(i); if (j == SND_SOC_TPLG_NUM_TEXTS) { tplg_dbg("error: text string number exceeds %d\n", j); return -ENOMEM; } /* get value */ if (snd_config_get_string(n, &value) < 0) continue; elem_copy_text(&texts->items[j][0], value, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); tplg_dbg("\t%s\n", &texts->items[j][0]); j++; }
/* directly add a reference elem */ int tplg_ref_add_elem(struct tplg_elem *elem, struct tplg_elem *elem_ref) { struct tplg_ref *ref; ref = calloc(1, sizeof(*ref)); if (!ref) return -ENOMEM; ref->type = elem_ref->type; ref->elem = elem_ref; elem_copy_text(ref->id, elem_ref->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN); list_add_tail(&ref->list, &elem->ref_list); return 0; }