Skip to content

Commit 25d1dfd

Browse files
softwareckikv2019i
authored andcommitted
lib_manager: Align native_system_agent_start return value
Change the signature of the native_system_agent_start function to match with the system_agent_start function. The function returns an error code and a pointer to the module interface is returned via the parameter. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent a1993c4 commit 25d1dfd

3 files changed

Lines changed: 33 additions & 10 deletions

File tree

src/audio/module_adapter/library/native_system_agent.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,24 @@ typedef void* (*native_create_instance_f)(void *mod_cfg, void *parent_ppl,
1919

2020
struct native_system_agent native_sys_agent;
2121

22-
void *native_system_agent_start(uint32_t entry_point, uint32_t module_id, uint32_t instance_id,
23-
uint32_t core_id, uint32_t log_handle, void *mod_cfg)
22+
int native_system_agent_start(uint32_t entry_point, uint32_t module_id, uint32_t instance_id,
23+
uint32_t core_id, uint32_t log_handle, void *mod_cfg,
24+
const void **iface)
2425
{
2526
native_sys_agent.module_id = module_id;
2627
native_sys_agent.instance_id = instance_id;
2728
native_sys_agent.core_id = core_id;
2829
native_sys_agent.log_handle = log_handle;
30+
const void *ret;
2931

3032
void *system_agent_p = &native_sys_agent;
3133

3234
native_create_instance_f ci = (native_create_instance_f)entry_point;
3335

34-
return ci(mod_cfg, NULL, &system_agent_p);
36+
ret = ci(mod_cfg, NULL, &system_agent_p);
37+
if (!ret)
38+
return -EINVAL;
39+
40+
*iface = ret;
41+
return 0;
3542
}

src/include/sof/audio/module_adapter/library/native_system_agent.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,23 @@ struct native_system_agent {
2020
uint32_t module_size;
2121
};
2222

23-
void *native_system_agent_start(uint32_t entry_point, uint32_t module_id, uint32_t instance_id,
24-
uint32_t core_id, uint32_t log_handle, void *mod_cfg);
23+
/**
24+
* @brief Starts the native system agent.
25+
*
26+
* This function initializes and starts the native system agent with the provided parameters.
27+
*
28+
* @param[in] entry_point - The module entry point function address.
29+
* @param[in] module_id - The identifier for the module.
30+
* @param[in] instance_id - The instance identifier of the module.
31+
* @param[in] core_id - Core on which the module will run.
32+
* @param[in] log_handle - The handle for logging purposes.
33+
* @param[in] mod_cfg - Pointer to the module configuration data.
34+
* @param[out] iface - Pointer to the module interface.
35+
*
36+
* @return Returns 0 on success or an error code on failure.
37+
*/
38+
int native_system_agent_start(uint32_t entry_point, uint32_t module_id, uint32_t instance_id,
39+
uint32_t core_id, uint32_t log_handle, void *mod_cfg,
40+
const void **iface);
2541

2642
#endif /* __NATIVE_SYSTEM_AGENT_H__ */

src/library_manager/lib_manager.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,9 @@ static struct comp_dev *lib_manager_module_create(const struct comp_driver *drv,
496496
const uint32_t module_id = IPC4_MOD_ID(config->id);
497497
const uint32_t instance_id = IPC4_INST_ID(config->id);
498498
const uint32_t log_handle = (uint32_t)drv->tctx;
499+
const struct module_interface *ops;
499500
byte_array_t mod_cfg;
501+
int ret;
500502

501503
/*
502504
* Variable used by llext_manager to temporary store llext handle before creation
@@ -518,11 +520,9 @@ static struct comp_dev *lib_manager_module_create(const struct comp_driver *drv,
518520
/* Intel modules expects DW size here */
519521
mod_cfg.size = args->size >> 2;
520522

521-
const struct module_interface *ops = native_system_agent_start(module_entry_point,
522-
module_id, instance_id,
523-
0, log_handle, &mod_cfg);
524-
525-
if (!ops) {
523+
ret = native_system_agent_start(module_entry_point, module_id, instance_id, 0, log_handle,
524+
&mod_cfg, (const void **)&ops);
525+
if (ret) {
526526
lib_manager_free_module(module_id);
527527
tr_err(&lib_manager_tr, "native_system_agent_start failed!");
528528
return NULL;

0 commit comments

Comments
 (0)