Skip to content

Commit

Permalink
module/base: modules: Remove module_adapter from module_data
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
softwarecki committed Mar 21, 2024
1 parent b093833 commit f2ad5d1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
26 changes: 13 additions & 13 deletions src/audio/module_adapter/module/modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

Expand All @@ -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);

Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}

/**
Expand All @@ -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));
}

/**
Expand All @@ -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*/
Expand Down
1 change: 0 additions & 1 deletion src/include/module/module/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; /**<loadable module interface handle */
uintptr_t module_entry_point; /**<loadable module entry point address */
struct llext *llext; /**< Zephyr loadable extension context */
#endif /* SOF_MODULE_PRIVATE */
Expand Down

0 comments on commit f2ad5d1

Please sign in to comment.