Commit c2cbd0a7 authored by Keyon Jie's avatar Keyon Jie Committed by Mark Brown

ASoC: topology: remove the redundant pass checks

As we have check the 'pass' in the soc_elem_pass_load(), so no need to
check it again in each specific elem_load function, at the same time,
the tplg->pos will be reset to the next header base when the pass is
mismatched, so the increasing of the tplg->pos in these cases made no
sense. Here remove all of them.
Signed-off-by: default avatarKeyon Jie <yang.jie@linux.intel.com>
Tested-by: default avatarVamshi Kerishna Gopal <vamshi.krishna.gopal@intel.com>
Tested-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200527022801.336264-3-yang.jie@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 82ed7418
...@@ -246,7 +246,7 @@ static inline void soc_control_err(struct soc_tplg *tplg, ...@@ -246,7 +246,7 @@ static inline void soc_control_err(struct soc_tplg *tplg,
} }
/* pass vendor data to component driver for processing */ /* pass vendor data to component driver for processing */
static int soc_tplg_vendor_load_(struct soc_tplg *tplg, static int soc_tplg_vendor_load(struct soc_tplg *tplg,
struct snd_soc_tplg_hdr *hdr) struct snd_soc_tplg_hdr *hdr)
{ {
int ret = 0; int ret = 0;
...@@ -268,16 +268,6 @@ static int soc_tplg_vendor_load_(struct soc_tplg *tplg, ...@@ -268,16 +268,6 @@ static int soc_tplg_vendor_load_(struct soc_tplg *tplg,
return ret; return ret;
} }
/* pass vendor data to component driver for processing */
static int soc_tplg_vendor_load(struct soc_tplg *tplg,
struct snd_soc_tplg_hdr *hdr)
{
if (tplg->pass != SOC_TPLG_PASS_VENDOR)
return 0;
return soc_tplg_vendor_load_(tplg, hdr);
}
/* optionally pass new dynamic widget to component driver. This is mainly for /* optionally pass new dynamic widget to component driver. This is mainly for
* external widgets where we can assign private data/ops */ * external widgets where we can assign private data/ops */
static int soc_tplg_widget_load(struct soc_tplg *tplg, static int soc_tplg_widget_load(struct soc_tplg *tplg,
...@@ -1127,12 +1117,6 @@ static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg, ...@@ -1127,12 +1117,6 @@ static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg,
int ret; int ret;
int i; int i;
if (tplg->pass != SOC_TPLG_PASS_MIXER) {
tplg->pos += le32_to_cpu(hdr->size) +
le32_to_cpu(hdr->payload_size);
return 0;
}
dev_dbg(tplg->dev, "ASoC: adding %d kcontrols at 0x%lx\n", hdr->count, dev_dbg(tplg->dev, "ASoC: adding %d kcontrols at 0x%lx\n", hdr->count,
soc_tplg_get_offset(tplg)); soc_tplg_get_offset(tplg));
...@@ -1204,14 +1188,6 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg, ...@@ -1204,14 +1188,6 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
count = le32_to_cpu(hdr->count); count = le32_to_cpu(hdr->count);
if (tplg->pass != SOC_TPLG_PASS_GRAPH) {
tplg->pos +=
le32_to_cpu(hdr->size) +
le32_to_cpu(hdr->payload_size);
return 0;
}
if (soc_tplg_check_elem_count(tplg, if (soc_tplg_check_elem_count(tplg,
sizeof(struct snd_soc_tplg_dapm_graph_elem), sizeof(struct snd_soc_tplg_dapm_graph_elem),
count, le32_to_cpu(hdr->payload_size), "graph")) { count, le32_to_cpu(hdr->payload_size), "graph")) {
...@@ -1741,9 +1717,6 @@ static int soc_tplg_dapm_widget_elems_load(struct soc_tplg *tplg, ...@@ -1741,9 +1717,6 @@ static int soc_tplg_dapm_widget_elems_load(struct soc_tplg *tplg,
count = le32_to_cpu(hdr->count); count = le32_to_cpu(hdr->count);
if (tplg->pass != SOC_TPLG_PASS_WIDGET)
return 0;
dev_dbg(tplg->dev, "ASoC: adding %d DAPM widgets\n", count); dev_dbg(tplg->dev, "ASoC: adding %d DAPM widgets\n", count);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
...@@ -2101,9 +2074,6 @@ static int soc_tplg_pcm_elems_load(struct soc_tplg *tplg, ...@@ -2101,9 +2074,6 @@ static int soc_tplg_pcm_elems_load(struct soc_tplg *tplg,
count = le32_to_cpu(hdr->count); count = le32_to_cpu(hdr->count);
if (tplg->pass != SOC_TPLG_PASS_PCM_DAI)
return 0;
/* check the element size and count */ /* check the element size and count */
pcm = (struct snd_soc_tplg_pcm *)tplg->pos; pcm = (struct snd_soc_tplg_pcm *)tplg->pos;
size = le32_to_cpu(pcm->size); size = le32_to_cpu(pcm->size);
...@@ -2386,12 +2356,6 @@ static int soc_tplg_link_elems_load(struct soc_tplg *tplg, ...@@ -2386,12 +2356,6 @@ static int soc_tplg_link_elems_load(struct soc_tplg *tplg,
count = le32_to_cpu(hdr->count); count = le32_to_cpu(hdr->count);
if (tplg->pass != SOC_TPLG_PASS_LINK) {
tplg->pos += le32_to_cpu(hdr->size) +
le32_to_cpu(hdr->payload_size);
return 0;
}
/* check the element size and count */ /* check the element size and count */
link = (struct snd_soc_tplg_link_config *)tplg->pos; link = (struct snd_soc_tplg_link_config *)tplg->pos;
size = le32_to_cpu(link->size); size = le32_to_cpu(link->size);
...@@ -2528,9 +2492,6 @@ static int soc_tplg_dai_elems_load(struct soc_tplg *tplg, ...@@ -2528,9 +2492,6 @@ static int soc_tplg_dai_elems_load(struct soc_tplg *tplg,
count = le32_to_cpu(hdr->count); count = le32_to_cpu(hdr->count);
if (tplg->pass != SOC_TPLG_PASS_BE_DAI)
return 0;
/* config the existing BE DAIs */ /* config the existing BE DAIs */
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
dai = (struct snd_soc_tplg_dai *)tplg->pos; dai = (struct snd_soc_tplg_dai *)tplg->pos;
...@@ -2610,9 +2571,6 @@ static int soc_tplg_manifest_load(struct soc_tplg *tplg, ...@@ -2610,9 +2571,6 @@ static int soc_tplg_manifest_load(struct soc_tplg *tplg,
bool abi_match; bool abi_match;
int ret = 0; int ret = 0;
if (tplg->pass != SOC_TPLG_PASS_MANIFEST)
return 0;
manifest = (struct snd_soc_tplg_manifest *)tplg->pos; manifest = (struct snd_soc_tplg_manifest *)tplg->pos;
/* check ABI version by size, create a new manifest if abi not match */ /* check ABI version by size, create a new manifest if abi not match */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment