From f2ad5d17a6014809b12ce741b5a22e32f00d54f9 Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Tue, 27 Feb 2024 16:01:55 +0100 Subject: [PATCH] module/base: modules: Remove module_adapter from module_data The value stored by the Processing Module Adapter in the module_adapter field of module_data structure has been moved to an unused private field. This change allowed the module_adapter field to be removed. Signed-off-by: Adrian Warecki --- src/audio/module_adapter/module/modules.c | 26 +++++++++++------------ src/include/module/module/base.h | 1 - 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/audio/module_adapter/module/modules.c b/src/audio/module_adapter/module/modules.c index 15cec1187671..476dd4509754 100644 --- a/src/audio/module_adapter/module/modules.c +++ b/src/audio/module_adapter/module/modules.c @@ -61,6 +61,7 @@ static int modules_init(struct processing_module *mod) const struct comp_driver *const drv = dev->drv; const struct ipc4_base_module_cfg *src_cfg = &md->cfg.base_cfg; const struct comp_ipc_config *config = &(dev->ipc_config); + void *system_agent; uintptr_t module_entry_point = lib_manager_allocate_module(mod, config, src_cfg); /* At this point module resources are allocated and it is moved to L2 memory. */ @@ -81,16 +82,16 @@ static int modules_init(struct processing_module *mod) .size = md->cfg.size >> 2, }; - md->module_adapter = (void *)system_agent_start(module_entry_point, module_id, instance_id, - 0, log_handle, &mod_cfg); - + system_agent = system_agent_start(module_entry_point, module_id, instance_id, 0, log_handle, + &mod_cfg); + module_set_private_data(mod, system_agent); md->module_entry_point = module_entry_point; md->mpd.in_buff_size = src_cfg->ibs; md->mpd.out_buff_size = src_cfg->obs; mod->proc_type = MODULE_PROCESS_TYPE_SOURCE_SINK; - return iadk_wrapper_init(md->module_adapter); + return iadk_wrapper_init(system_agent); } /** @@ -109,18 +110,17 @@ static int modules_prepare(struct processing_module *mod, struct sof_sink **sinks, int num_of_sinks) { struct comp_dev *dev = mod->dev; - const struct comp_driver *const drv = dev->drv; comp_info(dev, "modules_prepare()"); - return iadk_wrapper_prepare(mod->priv.module_adapter); + return iadk_wrapper_prepare(module_get_private_data(mod)); } static int modules_process(struct processing_module *mod, struct sof_source **sources, int num_of_sources, struct sof_sink **sinks, int num_of_sinks) { - return iadk_wrapper_process(mod->priv.module_adapter, sources, + return iadk_wrapper_process(module_get_private_data(mod), sources, num_of_sources, sinks, num_of_sinks); } @@ -137,7 +137,7 @@ static int modules_free(struct processing_module *mod) int ret; comp_info(dev, "modules_free()"); - ret = iadk_wrapper_free(mod->priv.module_adapter); + ret = iadk_wrapper_free(module_get_private_data(mod)); if (ret) comp_err(dev, "modules_free(): iadk_wrapper_free failed with error: %d", ret); @@ -170,7 +170,7 @@ static int modules_set_configuration(struct processing_module *mod, uint32_t con size_t fragment_size, uint8_t *response, size_t response_size) { - return iadk_wrapper_set_configuration(mod->priv.module_adapter, config_id, pos, + return iadk_wrapper_set_configuration(module_get_private_data(mod), config_id, pos, data_offset_size, fragment, fragment_size, response, response_size); } @@ -191,7 +191,7 @@ static int modules_get_configuration(struct processing_module *mod, uint32_t con uint32_t *data_offset_size, uint8_t *fragment, size_t fragment_size) { - return iadk_wrapper_get_configuration(mod->priv.module_adapter, config_id, + return iadk_wrapper_get_configuration(module_get_private_data(mod), config_id, MODULE_CFG_FRAGMENT_SINGLE, *data_offset_size, fragment, fragment_size); } @@ -206,7 +206,7 @@ static int modules_get_configuration(struct processing_module *mod, uint32_t con static int modules_set_processing_mode(struct processing_module *mod, enum module_processing_mode mode) { - return iadk_wrapper_set_processing_mode(mod->priv.module_adapter, mode); + return iadk_wrapper_set_processing_mode(module_get_private_data(mod), mode); } /** @@ -217,7 +217,7 @@ static int modules_set_processing_mode(struct processing_module *mod, */ static enum module_processing_mode modules_get_processing_mode(struct processing_module *mod) { - return iadk_wrapper_get_processing_mode(mod->priv.module_adapter); + return iadk_wrapper_get_processing_mode(module_get_private_data(mod)); } /** @@ -229,7 +229,7 @@ static enum module_processing_mode modules_get_processing_mode(struct processing */ static int modules_reset(struct processing_module *mod) { - return iadk_wrapper_reset(mod->priv.module_adapter); + return iadk_wrapper_reset(module_get_private_data(mod)); } /* Processing Module Adapter API*/ diff --git a/src/include/module/module/base.h b/src/include/module/module/base.h index d766fb3bb6fa..a40e803e0ec5 100644 --- a/src/include/module/module/base.h +++ b/src/include/module/module/base.h @@ -60,7 +60,6 @@ struct module_data { void *runtime_params; struct module_memory memory; /**< memory allocated by module */ struct module_processing_data mpd; /**< shared data comp <-> module */ - void *module_adapter; /**