@@ -339,8 +339,7 @@ static int lib_manager_free_module_instance(uint32_t module_id, uint32_t instanc
339339 return sys_mm_drv_unmap_region ((__sparse_force void * )va_base , bss_size );
340340}
341341
342- uintptr_t lib_manager_allocate_module (struct processing_module * proc ,
343- const struct comp_ipc_config * ipc_config ,
342+ uintptr_t lib_manager_allocate_module (const struct comp_ipc_config * ipc_config ,
344343 const void * ipc_specific_config )
345344{
346345 const struct sof_man_module * mod ;
@@ -359,7 +358,7 @@ uintptr_t lib_manager_allocate_module(struct processing_module *proc,
359358 }
360359
361360 if (module_is_llext (mod ))
362- return llext_manager_allocate_module (proc , ipc_config , ipc_specific_config );
361+ return llext_manager_allocate_module (ipc_config , ipc_specific_config );
363362
364363 ret = lib_manager_load_module (module_id , mod );
365364 if (ret < 0 )
@@ -424,8 +423,7 @@ int lib_manager_free_module(const uint32_t component_id)
424423
425424#define PAGE_SZ 4096 /* equals to MAN_PAGE_SIZE used by rimage */
426425
427- uintptr_t lib_manager_allocate_module (struct processing_module * proc ,
428- const struct comp_ipc_config * ipc_config ,
426+ uintptr_t lib_manager_allocate_module (const struct comp_ipc_config * ipc_config ,
429427 const void * ipc_specific_config , const void * * buildinfo )
430428{
431429 tr_err (& lib_manager_tr ,
@@ -517,12 +515,10 @@ static struct comp_dev *lib_manager_module_create(const struct comp_driver *drv,
517515 * Variable used by llext_manager to temporary store llext handle before creation
518516 * a instance of processing_module.
519517 */
520- struct processing_module tmp_proc ;
521518 struct comp_dev * dev ;
522519
523520 /* At this point module resources are allocated and it is moved to L2 memory. */
524- tmp_proc .priv .llext = NULL ;
525- const uint32_t module_entry_point = lib_manager_allocate_module (& tmp_proc , config ,
521+ const uint32_t module_entry_point = lib_manager_allocate_module (config ,
526522 args -> data );
527523
528524 if (!module_entry_point ) {
@@ -549,28 +545,24 @@ static struct comp_dev *lib_manager_module_create(const struct comp_driver *drv,
549545 }
550546
551547 dev = module_adapter_new (drv , config , spec );
552- if (dev ) {
553- struct processing_module * mod = comp_mod (dev );
554-
555- mod -> priv .llext = tmp_proc .priv .llext ;
556- } else {
548+ if (!dev )
557549 lib_manager_free_module (module_id );
558- }
550+
559551 return dev ;
560552}
561553
562554static void lib_manager_module_free (struct comp_dev * dev )
563555{
564556 struct processing_module * mod = comp_mod (dev );
565- struct llext * llext = mod -> priv .llext ;
566557 const struct comp_ipc_config * const config = & mod -> dev -> ipc_config ;
567558 const uint32_t module_id = config -> id ;
559+ struct lib_manager_mod_ctx * ctx = lib_manager_get_mod_ctx (module_id );
568560 int ret ;
569561
570562 /* This call invalidates dev, mod and config pointers! */
571563 module_adapter_free (dev );
572564
573- if (!llext || !llext_unload (& llext )) {
565+ if (!ctx -> llext || !llext_unload (& ctx -> llext )) {
574566 /* Free module resources allocated in L2 memory. */
575567 ret = lib_manager_free_module (module_id );
576568 if (ret < 0 )
0 commit comments