Skip to content

Commit e13eb9d

Browse files
committed
module_adapter: Separate module_adapter_new_ext function
Create a function module_adapter_new_ext that allows to assign a pointer to the private data of the module for which the adapter is being created. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent 284da09 commit e13eb9d

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

src/audio/module_adapter/module_adapter.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,28 @@ LOG_MODULE_REGISTER(module_adapter, CONFIG_SOF_LOG_LEVEL);
3434
* \param[in] drv - component driver pointer.
3535
* \param[in] config - component ipc descriptor pointer.
3636
* \param[in] spec - passdowned data from driver.
37+
* \param[in] mod_priv - Pointer to private data for processing module.
3738
*
3839
* \return: a pointer to newly created module adapter component on success. NULL on error.
3940
*/
4041
struct comp_dev *module_adapter_new(const struct comp_driver *drv,
41-
const struct comp_ipc_config *config,
42-
const void *spec)
42+
const struct comp_ipc_config *config, const void *spec)
43+
{
44+
return module_adapter_new_ext(drv, config, spec, NULL);
45+
}
46+
47+
/*
48+
* \brief Create a module adapter component.
49+
* \param[in] drv - component driver pointer.
50+
* \param[in] config - component ipc descriptor pointer.
51+
* \param[in] spec - passdowned data from driver.
52+
* \param[in] mod_priv - Pointer to private data for processing module.
53+
*
54+
* \return: a pointer to newly created module adapter component on success. NULL on error.
55+
*/
56+
struct comp_dev *module_adapter_new_ext(const struct comp_driver *drv,
57+
const struct comp_ipc_config *config, const void *spec,
58+
void *mod_priv)
4359
{
4460
int ret;
4561
struct comp_dev *dev;
@@ -79,6 +95,7 @@ struct comp_dev *module_adapter_new(const struct comp_driver *drv,
7995

8096
dst = &mod->priv.cfg;
8197

98+
module_set_private_data(mod, mod_priv);
8299
mod->dev = dev;
83100
dev->mod = mod;
84101

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ int module_unbind(struct processing_module *mod, struct bind_info *unbind_data);
209209

210210
struct comp_dev *module_adapter_new(const struct comp_driver *drv,
211211
const struct comp_ipc_config *config, const void *spec);
212+
struct comp_dev *module_adapter_new_ext(const struct comp_driver *drv,
213+
const struct comp_ipc_config *config, const void *spec,
214+
void *mod_priv);
212215
int module_adapter_prepare(struct comp_dev *dev);
213216
int module_adapter_params(struct comp_dev *dev, struct sof_ipc_stream_params *params);
214217
int module_adapter_copy(struct comp_dev *dev);

0 commit comments

Comments
 (0)