diff --git a/src/audio/dai.c b/src/audio/dai.c index 3aba31ff3b35..f4064db1ce41 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -837,9 +837,7 @@ static struct comp_driver comp_dai = { }, }; -void sys_comp_dai_init(void); - -void sys_comp_dai_init(void) +static void sys_comp_dai_init(void) { comp_register(&comp_dai); } diff --git a/src/audio/eq_fir.c b/src/audio/eq_fir.c index 5add3e303281..df922adb07b4 100644 --- a/src/audio/eq_fir.c +++ b/src/audio/eq_fir.c @@ -816,9 +816,7 @@ struct comp_driver comp_eq_fir = { }, }; -void sys_comp_eq_fir_init(void); - -void sys_comp_eq_fir_init(void) +static void sys_comp_eq_fir_init(void) { comp_register(&comp_eq_fir); } diff --git a/src/audio/eq_iir.c b/src/audio/eq_iir.c index 75c739da3f13..02b0f901c77a 100644 --- a/src/audio/eq_iir.c +++ b/src/audio/eq_iir.c @@ -936,9 +936,8 @@ struct comp_driver comp_eq_iir = { }, }; -void sys_comp_eq_iir_init(void); -void sys_comp_eq_iir_init(void) +static void sys_comp_eq_iir_init(void) { comp_register(&comp_eq_iir); } diff --git a/src/audio/host.c b/src/audio/host.c index fefcdae54a51..e5358755b750 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -855,9 +855,7 @@ struct comp_driver comp_host = { }, }; -void sys_comp_host_init(void); - -void sys_comp_host_init(void) +static void sys_comp_host_init(void) { comp_register(&comp_host); } diff --git a/src/audio/kpb.c b/src/audio/kpb.c index f5fc06072844..1acfa1dc2a8c 100644 --- a/src/audio/kpb.c +++ b/src/audio/kpb.c @@ -43,6 +43,7 @@ #include #include #include +#include static void kpb_event_handler(int message, void *cb_data, void *event_data); static int kpb_register_client(struct comp_data *kpb, struct kpb_client *cli); @@ -545,9 +546,7 @@ struct comp_driver comp_kpb = { }, }; -void sys_comp_kpb_init(void); - -void sys_comp_kpb_init(void) +UT_STATIC void sys_comp_kpb_init(void) { comp_register(&comp_kpb); } diff --git a/src/audio/mixer.c b/src/audio/mixer.c index 86fbe9a2b6e7..e710edac6a47 100644 --- a/src/audio/mixer.c +++ b/src/audio/mixer.c @@ -38,6 +38,7 @@ #include #include #include +#include #define trace_mixer(__e, ...) \ trace_event(TRACE_CLASS_MIXER, __e, ##__VA_ARGS__) @@ -445,9 +446,7 @@ struct comp_driver comp_mixer = { }, }; -void sys_comp_mixer_init(void); - -void sys_comp_mixer_init(void) +UT_STATIC void sys_comp_mixer_init(void) { comp_register(&comp_mixer); } diff --git a/src/audio/mux.c b/src/audio/mux.c index d0e369fabb17..0a7a261b31c9 100644 --- a/src/audio/mux.c +++ b/src/audio/mux.c @@ -97,9 +97,7 @@ struct comp_driver comp_mux = { }, }; -void sys_comp_mux_init(void); - -void sys_comp_mux_init(void) +static void sys_comp_mux_init(void) { comp_register(&comp_mux); } diff --git a/src/audio/selector.c b/src/audio/selector.c index bbef436ffd43..77237525a240 100644 --- a/src/audio/selector.c +++ b/src/audio/selector.c @@ -516,10 +516,8 @@ struct comp_driver comp_selector = { }, }; -void sys_comp_selector_init(void); - /** \brief Initializes selector component. */ -void sys_comp_selector_init(void) +static void sys_comp_selector_init(void) { comp_register(&comp_selector); } diff --git a/src/audio/src.c b/src/audio/src.c index 9fbc6fd51920..889830dc18f8 100644 --- a/src/audio/src.c +++ b/src/audio/src.c @@ -980,9 +980,7 @@ struct comp_driver comp_src = { }, }; -void sys_comp_src_init(void); - -void sys_comp_src_init(void) +static void sys_comp_src_init(void) { comp_register(&comp_src); } diff --git a/src/audio/switch.c b/src/audio/switch.c index 2d71ec7292b0..e3152b885052 100644 --- a/src/audio/switch.c +++ b/src/audio/switch.c @@ -97,9 +97,7 @@ struct comp_driver comp_switch = { }, }; -void sys_comp_switch_init(void); - -void sys_comp_switch_init(void) +static void sys_comp_switch_init(void) { comp_register(&comp_switch); } diff --git a/src/audio/tone.c b/src/audio/tone.c index 6ff7e8e707fd..adc626566189 100644 --- a/src/audio/tone.c +++ b/src/audio/tone.c @@ -762,9 +762,7 @@ struct comp_driver comp_tone = { }, }; -void sys_comp_tone_init(void); - -void sys_comp_tone_init(void) +static void sys_comp_tone_init(void) { comp_register(&comp_tone); } diff --git a/src/audio/volume.c b/src/audio/volume.c index e852b88a7242..65e5a39a0fe6 100644 --- a/src/audio/volume.c +++ b/src/audio/volume.c @@ -667,12 +667,10 @@ struct comp_driver comp_volume = { }, }; -void sys_comp_volume_init(void); - /** * \brief Initializes volume component. */ -void sys_comp_volume_init(void) +static void sys_comp_volume_init(void) { comp_register(&comp_volume); } diff --git a/src/include/sof/ut.h b/src/include/sof/ut.h new file mode 100644 index 000000000000..4c60bcb02aa6 --- /dev/null +++ b/src/include/sof/ut.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2019, Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Janusz Jankowski + */ + +#ifndef __INCLUDE_SOF_UT__ +#define __INCLUDE_SOF_UT__ + +/* UT_STATIC makes function unit-testable (non-static) when built for unit tests + */ +#ifdef CHECK +#define UT_STATIC +#else +#define UT_STATIC static +#endif + +#endif