From 47917c1f3dd0cb522851bf47fa775198467274e1 Mon Sep 17 00:00:00 2001 From: Tomasz Lauda Date: Fri, 17 Jan 2020 11:21:11 +0100 Subject: [PATCH] component: pass sof context to sys_comp_init() Passes sof context pointer to sys_comp_init() function. It will be needed in order to add comp_driver_list to sof context. Signed-off-by: Tomasz Lauda --- src/audio/component.c | 3 ++- src/include/sof/audio/component.h | 3 ++- src/schedule/task.c | 2 +- test/cmocka/src/audio/mux/demux_copy.c | 2 +- test/cmocka/src/audio/mux/mock.c | 7 +++++++ test/cmocka/src/audio/mux/mux_copy.c | 2 +- test/cmocka/src/audio/mux/mux_prepare.c | 2 +- tools/testbench/common_test.c | 2 +- 8 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/audio/component.c b/src/audio/component.c index 00d5adf3c..df4b14fbe 100644 --- a/src/audio/component.c +++ b/src/audio/component.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -188,7 +189,7 @@ int comp_set_state(struct comp_dev *dev, int cmd) return ret; } -void sys_comp_init(void) +void sys_comp_init(struct sof *sof) { list_init(&cd.list); } diff --git a/src/include/sof/audio/component.h b/src/include/sof/audio/component.h index 3a901d50e..d4e4b1be5 100644 --- a/src/include/sof/audio/component.h +++ b/src/include/sof/audio/component.h @@ -35,6 +35,7 @@ #include struct comp_dev; +struct sof; struct sof_ipc_dai_config; struct sof_ipc_stream_posn; struct dai_hw_params; @@ -561,7 +562,7 @@ static inline int comp_set_attribute(struct comp_dev *dev, uint32_t type, * Allocates and initializes audio component list. * To be called once at boot time. */ -void sys_comp_init(void); +void sys_comp_init(struct sof *sof); /** @}*/ diff --git a/src/schedule/task.c b/src/schedule/task.c index ab9679ba1..318a53d03 100644 --- a/src/schedule/task.c +++ b/src/schedule/task.c @@ -93,7 +93,7 @@ int task_main_start(struct sof *sof) int ret; /* init default audio components */ - sys_comp_init(); + sys_comp_init(sof); /* init self-registered modules */ sys_module_init(); diff --git a/test/cmocka/src/audio/mux/demux_copy.c b/test/cmocka/src/audio/mux/demux_copy.c index 5038be0e6..a2ee0a2dd 100644 --- a/test/cmocka/src/audio/mux/demux_copy.c +++ b/test/cmocka/src/audio/mux/demux_copy.c @@ -82,7 +82,7 @@ static uint8_t masks[][MUX_MAX_STREAMS][PLATFORM_MAX_CHANNELS] = { static int setup_group(void **state) { - sys_comp_init(); + sys_comp_init(sof_get()); sys_comp_mux_init(); return 0; diff --git a/test/cmocka/src/audio/mux/mock.c b/test/cmocka/src/audio/mux/mock.c index 56fb62512..1088f5a04 100644 --- a/test/cmocka/src/audio/mux/mock.c +++ b/test/cmocka/src/audio/mux/mock.c @@ -18,6 +18,8 @@ TRACE_IMPL() +static struct sof sof; + void rfree(void *ptr) { free(ptr); @@ -51,3 +53,8 @@ void __panic(uint32_t p, char *filename, uint32_t linenum) abort(); } + +struct sof *sof_get(void) +{ + return &sof; +} diff --git a/test/cmocka/src/audio/mux/mux_copy.c b/test/cmocka/src/audio/mux/mux_copy.c index d07240939..55bb24ccc 100644 --- a/test/cmocka/src/audio/mux/mux_copy.c +++ b/test/cmocka/src/audio/mux/mux_copy.c @@ -94,7 +94,7 @@ static uint8_t masks[][MUX_MAX_STREAMS][PLATFORM_MAX_CHANNELS] = { static int setup_group(void **state) { - sys_comp_init(); + sys_comp_init(sof_get()); sys_comp_mux_init(); return 0; diff --git a/test/cmocka/src/audio/mux/mux_prepare.c b/test/cmocka/src/audio/mux/mux_prepare.c index 82bc071ec..31b276b3d 100644 --- a/test/cmocka/src/audio/mux/mux_prepare.c +++ b/test/cmocka/src/audio/mux/mux_prepare.c @@ -22,7 +22,7 @@ struct test_data { static int setup_group(void **state) { - sys_comp_init(); + sys_comp_init(sof_get()); sys_comp_mux_init(); return 0; diff --git a/tools/testbench/common_test.c b/tools/testbench/common_test.c index 648842845..4f970b5b7 100644 --- a/tools/testbench/common_test.c +++ b/tools/testbench/common_test.c @@ -27,7 +27,7 @@ int tb_pipeline_setup(struct sof *sof) { /* init components */ - sys_comp_init(); + sys_comp_init(sof); /* init IPC */ if (ipc_init(sof) < 0) {