mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-02-28 01:40:08 -05:00
topology: Rename varaibles for add physical links by C API
Code refactoring. When adding a physical link element from C API: - Rename "link" to "link_tpl" for physical link config template for C API users. - Rename "lk" to "link" for physical link elements created by topology internally. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
50e7190d35
commit
cb9451b8e7
1 changed files with 14 additions and 10 deletions
|
|
@ -740,10 +740,11 @@ int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add a physical DAI link element from C API */
|
||||||
int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
|
int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
|
||||||
{
|
{
|
||||||
struct snd_tplg_link_template *link = t->link;
|
struct snd_tplg_link_template *link_tpl = t->link;
|
||||||
struct snd_soc_tplg_link_config *lk;
|
struct snd_soc_tplg_link_config *link, *_link;
|
||||||
struct tplg_elem *elem;
|
struct tplg_elem *elem;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -751,22 +752,25 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* here type can be either BE or CC. */
|
/* here type can be either BE or CC. */
|
||||||
elem = tplg_elem_new_common(tplg, NULL, link->name, t->type);
|
elem = tplg_elem_new_common(tplg, NULL, link_tpl->name, t->type);
|
||||||
if (!elem)
|
if (!elem)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
if (t->type == SND_TPLG_TYPE_BE)
|
if (t->type == SND_TPLG_TYPE_BE)
|
||||||
tplg_dbg("BE Link: %s", link->name);
|
tplg_dbg("BE Link: %s", link_tpl->name);
|
||||||
else
|
else
|
||||||
tplg_dbg("CC Link: %s", link->name);
|
tplg_dbg("CC Link: %s", link_tpl->name);
|
||||||
|
|
||||||
lk = elem->link;
|
link = elem->link;
|
||||||
lk->size = elem->size;
|
link->size = elem->size;
|
||||||
lk->id = link->id;
|
|
||||||
lk->num_streams = link->num_streams;
|
|
||||||
|
|
||||||
|
link->id = link_tpl->id;
|
||||||
|
/* stream configs */
|
||||||
|
if (link_tpl->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX)
|
||||||
|
return -EINVAL;
|
||||||
|
link->num_streams = link_tpl->num_streams;
|
||||||
for (i = 0; i < link->num_streams; i++)
|
for (i = 0; i < link->num_streams; i++)
|
||||||
tplg_add_stream_object(&lk->stream[i], &link->stream[i]);
|
tplg_add_stream_object(&link->stream[i], &link_tpl->stream[i]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue