diff options
author | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> | 2022-10-27 11:27:06 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-10-28 17:19:21 +0100 |
commit | 4efb98e9635b9919f2cb72cddae97b7231cf96ef (patch) | |
tree | f17a28842979e8963bddf62bc70c9ab88a69743e /sound/soc/qcom/qdsp6 | |
parent | e4977b91cff8b00cdeb310735ef34fa4dee9485c (diff) | |
download | linux-stable-4efb98e9635b9919f2cb72cddae97b7231cf96ef.tar.gz linux-stable-4efb98e9635b9919f2cb72cddae97b7231cf96ef.tar.bz2 linux-stable-4efb98e9635b9919f2cb72cddae97b7231cf96ef.zip |
ASoC: qdsp6: audioreach: simplify module_list sz calculation
Simplify module_list size calculation by doing inside modules loop.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20221027102710.21407-6-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/qcom/qdsp6')
-rw-r--r-- | sound/soc/qcom/qdsp6/audioreach.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c index 0015ec89d90b..87a3fd1f8107 100644 --- a/sound/soc/qcom/qdsp6/audioreach.c +++ b/sound/soc/qcom/qdsp6/audioreach.c @@ -430,7 +430,6 @@ void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct audioreach_graph_info struct audioreach_sub_graph *sgs; struct apm_mod_list_obj *mlobj; struct list_head *sg_list; - int num_modules_per_list; int num_connections = 0; int num_containers = 0; int num_sub_graphs = 0; @@ -451,6 +450,9 @@ void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct audioreach_graph_info list_for_each_entry(container, &sgs->container_list, node) { num_containers++; num_modules += container->num_modules; + ml_sz = ml_sz + sizeof(struct apm_module_list_params) + + APM_MOD_LIST_OBJ_PSIZE(mlobj, container->num_modules); + list_for_each_entry(module, &container->modules_list, node) { if (module->src_mod_inst_id) num_connections++; @@ -459,11 +461,11 @@ void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct audioreach_graph_info } num_modules_list = num_containers; - num_modules_per_list = num_modules/num_containers; sg_sz = APM_SUB_GRAPH_PSIZE(sg_params, num_sub_graphs); cont_sz = APM_CONTAINER_PSIZE(cont_params, num_containers); - ml_sz = ALIGN(sizeof(struct apm_module_list_params) + - num_modules_list * APM_MOD_LIST_OBJ_PSIZE(mlobj, num_modules_per_list), 8); + + ml_sz = ALIGN(ml_sz, 8); + mp_sz = APM_MOD_PROP_PSIZE(mprop, num_modules); mc_sz = APM_MOD_CONN_PSIZE(mcon, num_connections); |