Skip to content

Commit 4fde218

Browse files
kv2019ilgirdwood
authored andcommitted
zephyr: lib: add build assert on NUM_CLOCKS
Add a build assert to ensure platform NUM_CLOCKS is set to at least CONFIG_CORE_COUNT. This is assumed to hold in the implementation of platform_clock_init(). Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent 8bd2522 commit 4fde218

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

zephyr/lib/clk.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ void platform_clock_init(struct sof *sof)
2828

2929
sof->clocks = platform_clocks_info;
3030

31+
/*
32+
* plafforms using this clk.c implementation must
33+
* declare the CPU clocks first, and there must be at least
34+
* one clock per core. If this model doesn't fit, platform
35+
* needs a custom platform_clock_init.
36+
*/
37+
BUILD_ASSERT(NUM_CLOCKS >= CONFIG_CORE_COUNT, "Invalid NUM_CLOCKS");
38+
3139
for (i = 0; i < CONFIG_CORE_COUNT; i++) {
3240
sof->clocks[i] = (struct clock_info) {
3341
.freqs_num = NUM_CPU_FREQ,

0 commit comments

Comments
 (0)