|
7 | 7 | */
|
8 | 8 |
|
9 | 9 | #include <zephyr/autoconf.h>
|
10 |
| -#include <zephyr/kernel.h> |
11 | 10 | #include <zephyr/init.h>
|
| 11 | +#include <zephyr/kernel.h> |
12 | 12 | #include <zephyr/kernel/thread_stack.h>
|
| 13 | +#include <zephyr/sys/util_macro.h> |
| 14 | +#include <zephyr/toolchain.h> |
13 | 15 |
|
14 | 16 | static K_THREAD_STACK_DEFINE(bt_taskq_stack, CONFIG_BT_TASKQ_STACK_SIZE);
|
15 |
| -struct k_work_q bt_taskq; |
| 17 | +static struct k_work_q bt_taskq; |
16 | 18 |
|
17 |
| -static int bt_taskq_init(void) |
| 19 | +__maybe_unused static int bt_taskq_init(void) |
18 | 20 | {
|
19 |
| - struct k_work_queue_config cfg = { |
20 |
| - .name = "bt_taskq", |
21 |
| - }; |
| 21 | + struct k_work_queue_config cfg = {}; |
| 22 | + |
| 23 | + if (IS_ENABLED(CONFIG_THREAD_NAME)) { |
| 24 | + cfg.name = "bt_taskq"; |
| 25 | + } |
22 | 26 |
|
23 | 27 | k_work_queue_start(&bt_taskq, bt_taskq_stack, K_THREAD_STACK_SIZEOF(bt_taskq_stack),
|
24 | 28 | CONFIG_BT_TASKQ_THREAD_PRIO, &cfg);
|
25 | 29 |
|
26 | 30 | return 0;
|
27 | 31 | }
|
28 | 32 |
|
| 33 | +#if defined(CONFIG_BT_TASKQ_DEDICATED) |
29 | 34 | /* The init priority is set to POST_KERNEL 999, the last level
|
30 | 35 | * before APPLICATION.
|
31 | 36 | */
|
32 | 37 | SYS_INIT(bt_taskq_init, POST_KERNEL, 999);
|
| 38 | +#endif /* CONFIG_BT_TASKQ_DEDICATED */ |
| 39 | + |
| 40 | +/* Exports */ |
| 41 | +struct k_work_q *const bt_taskq_chosen = |
| 42 | + COND_CODE_1(CONFIG_BT_TASKQ_DEDICATED, (&bt_taskq), (&k_sys_work_q)); |
0 commit comments