We insert a new element into the object list based on its index value, so we parse
index value in "tplg_elem_new_common" before insert it, and then remove code
parsing index value in parsing each object.
Signed-off-by: Fuwei Tang <fuweix.tang@intel.com>
Reviewed-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
if (id[0] == '#')
continue;
- if (strcmp(id, "index") == 0) {
- if (snd_config_get_string(n, &val) < 0)
- return -EINVAL;
-
- elem->index = atoi(val);
- tplg_dbg("\t%s: %d\n", id, elem->index);
- continue;
- }
-
if (strcmp(id, "base") == 0) {
if (snd_config_get_string(n, &val) < 0)
return -EINVAL;
if (id[0] == '#')
continue;
- if (strcmp(id, "index") == 0) {
- if (snd_config_get_string(n, &val) < 0)
- return -EINVAL;
-
- elem->index = atoi(val);
- tplg_dbg("\t%s: %d\n", id, elem->index);
- continue;
- }
-
if (strcmp(id, "texts") == 0) {
if (snd_config_get_string(n, &val) < 0)
return -EINVAL;
if (id[0] == '#')
continue;
- if (strcmp(id, "index") == 0) {
- if (snd_config_get_string(n, &val) < 0)
- return -EINVAL;
-
- elem->index = atoi(val);
- tplg_dbg("\t%s: %d\n", id, elem->index);
- continue;
- }
-
if (strcmp(id, "channel") == 0) {
if (mc->num_channels >= SND_SOC_TPLG_MAX_CHAN) {
SNDERR("error: too many channels %s\n",
if (id[0] == '#')
continue;
- if (strcmp(id, "index") == 0) {
- if (snd_config_get_string(n, &val) < 0)
- return -EINVAL;
-
- elem->index = atoi(val);
- tplg_dbg("\t%s: %d\n", id, elem->index);
- continue;
- }
-
if (strcmp(id, "type") == 0) {
if (snd_config_get_string(n, &val) < 0)
return -EINVAL;
continue;
}
- if (strcmp(id, "index") == 0) {
- if (snd_config_get_string(n, &val) < 0)
- return -EINVAL;
-
- elem->index = atoi(val);
- tplg_dbg("\t%s: %d\n", id, elem->index);
- continue;
- }
-
if (strcmp(id, "type") == 0) {
if (snd_config_get_string(n, &val) < 0)
return -EINVAL;
if (id[0] == '#')
continue;
- if (strcmp(id, "index") == 0) {
- if (snd_config_get_string(n, &val) < 0)
- return -EINVAL;
-
- elem->index = atoi(val);
- tplg_dbg("\t%s: %d\n", id, elem->index);
- continue;
- }
-
if (strcmp(id, "id") == 0) {
if (snd_config_get_string(n, &val) < 0)
return -EINVAL;
if (id[0] == '#')
continue;
- if (strcmp(id, "index") == 0) {
- if (snd_config_get_string(n, &val) < 0)
- return -EINVAL;
-
- elem->index = atoi(val);
- tplg_dbg("\t%s: %d\n", id, elem->index);
- continue;
- }
-
if (strcmp(id, "id") == 0) {
if (snd_config_get_string(n, &val) < 0)
return -EINVAL;
if (id[0] == '#')
continue;
- if (strcmp(id, "index") == 0) {
- if (snd_config_get_string(n, &val) < 0)
- return -EINVAL;
-
- elem->index = atoi(val);
- tplg_dbg("\t%s: %d\n", id, elem->index);
- continue;
- }
-
if (strcmp(id, "id") == 0) {
if (snd_config_get_string(n, &val) < 0)
return -EINVAL;
if (id[0] == '#')
continue;
- if (strcmp(id, "index") == 0) {
- if (snd_config_get_string(n, &val) < 0)
- return -EINVAL;
-
- elem->index = atoi(val);
- tplg_dbg("\t%s: %d\n", id, elem->index);
- continue;
- }
-
if (strcmp(id, "id") == 0) {
if (snd_config_get_string(n, &val) < 0)
return -EINVAL;