Skip to content

Commit 53d3481

Browse files
committed
module_adapter: Add user_ctx parameter to module_adapter_new_ext
Extend the module_adapter_new_ext function with an additional user_ctx parameter. This enables the caller to explicitly set the userspace context field within the processing module structure during module adapter initialization. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent c8f4a13 commit 53d3481

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

src/audio/module_adapter/module_adapter.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ LOG_MODULE_REGISTER(module_adapter, CONFIG_SOF_LOG_LEVEL);
4141
struct comp_dev *module_adapter_new(const struct comp_driver *drv,
4242
const struct comp_ipc_config *config, const void *spec)
4343
{
44-
return module_adapter_new_ext(drv, config, spec, NULL);
44+
return module_adapter_new_ext(drv, config, spec, NULL, NULL);
4545
}
4646

4747
static struct processing_module *module_adapter_mem_alloc(const struct comp_driver *drv,
@@ -108,7 +108,7 @@ static void module_adapter_mem_free(struct processing_module *mod)
108108
*/
109109
struct comp_dev *module_adapter_new_ext(const struct comp_driver *drv,
110110
const struct comp_ipc_config *config, const void *spec,
111-
void *mod_priv)
111+
void *mod_priv, struct userspace_context *user_ctx)
112112
{
113113
int ret;
114114
struct module_config *dst;
@@ -127,14 +127,16 @@ struct comp_dev *module_adapter_new_ext(const struct comp_driver *drv,
127127
if (!mod)
128128
return NULL;
129129

130-
dst = &mod->priv.cfg;
131130

132131
module_set_private_data(mod, mod_priv);
133-
134-
struct comp_dev *dev = mod->dev;
135-
132+
#if CONFIG_USERSPACE
133+
mod->user_ctx = user_ctx;
134+
#endif /* CONFIG_USERSPACE */
135+
136136
list_init(&mod->raw_data_buffers_list);
137137

138+
struct comp_dev *dev = mod->dev;
139+
dst = &mod->priv.cfg;
138140
ret = module_adapter_init_data(dev, dst, config, spec);
139141
if (ret) {
140142
comp_err(dev, "%d: module init data failed",

src/include/sof/audio/module_adapter/module/generic.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,10 @@ int module_unbind(struct processing_module *mod, struct bind_info *unbind_data);
300300

301301
struct comp_dev *module_adapter_new(const struct comp_driver *drv,
302302
const struct comp_ipc_config *config, const void *spec);
303+
struct userspace_context;
303304
struct comp_dev *module_adapter_new_ext(const struct comp_driver *drv,
304305
const struct comp_ipc_config *config, const void *spec,
305-
void *mod_priv);
306+
void *mod_priv, struct userspace_context *user_ctx);
306307
int module_adapter_prepare(struct comp_dev *dev);
307308
int module_adapter_params(struct comp_dev *dev, struct sof_ipc_stream_params *params);
308309
int module_adapter_copy(struct comp_dev *dev);

src/library_manager/lib_manager.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ static struct comp_dev *lib_manager_module_create(const struct comp_driver *drv,
645645
if (ops && comp_set_adapter_ops(drv, ops) < 0)
646646
goto err;
647647

648-
dev = module_adapter_new_ext(drv, config, spec, adapter_priv);
648+
dev = module_adapter_new_ext(drv, config, spec, adapter_priv, NULL);
649649
if (!dev)
650650
goto err;
651651

0 commit comments

Comments
 (0)