audio: comp_ext: workaround XCC compatibility with zephyr logging

Multiple use of static inline functions that call Zephyr logging
API across different C files will result in same symbol names
defined in all of the corresponding object files with XCC,
because XCC compiler emits the same symbol names based on the
source file for those static variables inside functions.

If Zephyr logging is used in SOF, we will have log context
redefinition issue with XCC due to above reason.

This patch workarounds the issue by removing the log calls
in static inline functions that are used across multiple C
files if Zephyr is used.

BugLink: https://github.com/zephyrproject-rtos/zephyr/issues/43786

Signed-off-by: Chao Song <chao.song@linux.intel.com>
This commit is contained in:
Chao Song 2022-03-21 16:27:39 +08:00 committed by Liam Girdwood
parent 27e9635227
commit 5eb94a8a80
1 changed files with 18 additions and 0 deletions

View File

@ -84,8 +84,14 @@ static inline int comp_params(struct comp_dev *dev,
} else { } else {
/* not defined, run the default handler */ /* not defined, run the default handler */
ret = comp_verify_params(dev, 0, params); ret = comp_verify_params(dev, 0, params);
/* BugLink: https://github.com/zephyrproject-rtos/zephyr/issues/43786
* TODO: Remove this once the bug gets fixed.
*/
#ifndef __ZEPHYR__
if (ret < 0) if (ret < 0)
comp_err(dev, "pcm params verification failed"); comp_err(dev, "pcm params verification failed");
#endif
} }
} }
@ -172,9 +178,21 @@ static inline int comp_copy(struct comp_dev *dev)
/* copy only if we are the owner of the component */ /* copy only if we are the owner of the component */
if (cpu_is_me(dev->ipc_config.core)) { if (cpu_is_me(dev->ipc_config.core)) {
/* BugLink: https://github.com/zephyrproject-rtos/zephyr/issues/43786
* TODO: Remove this once the bug gets fixed.
*/
#ifndef __ZEPHYR__
perf_cnt_init(&dev->pcd); perf_cnt_init(&dev->pcd);
#endif
ret = dev->drv->ops.copy(dev); ret = dev->drv->ops.copy(dev);
/* BugLink: https://github.com/zephyrproject-rtos/zephyr/issues/43786
* TODO: Remove this once the bug gets fixed.
*/
#ifndef __ZEPHYR__
perf_cnt_stamp(&dev->pcd, comp_perf_info, dev); perf_cnt_stamp(&dev->pcd, comp_perf_info, dev);
#endif
} }
return ret; return ret;