From 0bee91dae1ff9075d05795dfdf14f2a16432ec65 Mon Sep 17 00:00:00 2001 From: Benjamin Walsh Date: Thu, 15 Sep 2016 17:16:38 -0400 Subject: [PATCH] unified: fix some leftover K__DEFINE macros The K__DEFINE macros in the unified kernel create objects of name 'name', and not a pointer named 'name' to an object. Some macros contained the code from early prototyping. Change-Id: I7262570fbe0b267012874eac0185b4e0cd7f523d Signed-off-by: Benjamin Walsh --- include/kernel.h | 13 ++++--------- kernel/unified/mailbox.c | 6 +++--- kernel/unified/pipes.c | 6 +++--- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/include/kernel.h b/include/kernel.h index 63d4f2a8138..35734a7aaeb 100644 --- a/include/kernel.h +++ b/include/kernel.h @@ -343,9 +343,7 @@ extern void *k_fifo_get(struct k_fifo *fifo, int32_t timeout); } #define K_FIFO_DEFINE(name) \ - struct k_fifo _k_fifo_obj_##name = \ - K_FIFO_INITIALIZER(_k_fifo_obj_##name); \ - struct k_fifo * const name = &_k_fifo_obj_##name + struct k_fifo name = K_FIFO_INITIALIZER(name) /* lifos */ @@ -368,9 +366,7 @@ extern void *k_lifo_get(struct k_lifo *lifo, int32_t timeout); } #define K_LIFO_DEFINE(name) \ - struct k_lifo _k_lifo_obj_##name = \ - K_LIFO_INITIALIZER(_k_lifo_obj_##name); \ - struct k_lifo * const name = &_k_lifo_obj_##name + struct k_lifo name = K_LIFO_INITIALIZER(name) /* stacks */ @@ -398,10 +394,9 @@ extern int k_stack_pop(struct k_stack *stack, uint32_t *data, int32_t timeout); #define K_STACK_DEFINE(name, stack_num_entries) \ uint32_t __noinit _k_stack_buf_##name[stack_num_entries]; \ - struct k_stack _k_stack_obj_##name = \ - K_STACK_INITIALIZER(_k_stack_obj_##name, stack_num_entries, \ + struct k_stack name = \ + K_STACK_INITIALIZER(name, stack_num_entries, \ _k_stack_buf_##name); \ - struct k_stack * const name = &_k_stack_obj_##name #define K_STACK_SIZE(stack_num_entries) \ (sizeof(struct k_stack) + (stack_num_entries * sizeof(uint32_t))) diff --git a/kernel/unified/mailbox.c b/kernel/unified/mailbox.c index 80717736299..499e25fff9f 100644 --- a/kernel/unified/mailbox.c +++ b/kernel/unified/mailbox.c @@ -61,7 +61,7 @@ void _k_mbox_init(void) for (i = 0; i < CONFIG_NUM_MBOX_ASYNC_MSGS; i++) { async_msg[i].thread.flags = K_DUMMY; - k_stack_push(async_msg_free, (uint32_t)&async_msg[i]); + k_stack_push(&async_msg_free, (uint32_t)&async_msg[i]); } } @@ -74,7 +74,7 @@ void _k_mbox_init(void) */ static inline void _mbox_async_alloc(struct k_mbox_async **async) { - k_stack_pop(async_msg_free, (uint32_t *)async, K_FOREVER); + k_stack_pop(&async_msg_free, (uint32_t *)async, K_FOREVER); } /** @@ -84,7 +84,7 @@ static inline void _mbox_async_alloc(struct k_mbox_async **async) */ static inline void _mbox_async_free(struct k_mbox_async *async) { - k_stack_push(async_msg_free, (uint32_t)async); + k_stack_push(&async_msg_free, (uint32_t)async); } #endif diff --git a/kernel/unified/pipes.c b/kernel/unified/pipes.c index f43deb69099..8fdd3a3aa4d 100644 --- a/kernel/unified/pipes.c +++ b/kernel/unified/pipes.c @@ -68,7 +68,7 @@ void _k_pipes_init(void) for (int i = 0; i < CONFIG_NUM_PIPE_ASYNC_MSGS; i++) { async_msg[i].thread.flags = K_DUMMY; async_msg[i].thread.swap_data = &async_msg[i].desc; - k_stack_push(pipe_async_msgs, (uint32_t)&async_msg[i]); + k_stack_push(&pipe_async_msgs, (uint32_t)&async_msg[i]); } } @@ -93,7 +93,7 @@ void k_pipe_init(struct k_pipe *pipe, unsigned char *buffer, size_t size) */ static void _pipe_async_alloc(struct k_pipe_async **async) { - k_stack_pop(pipe_async_msgs, (uint32_t *)async, K_FOREVER); + k_stack_pop(&pipe_async_msgs, (uint32_t *)async, K_FOREVER); } /** @@ -105,7 +105,7 @@ static void _pipe_async_alloc(struct k_pipe_async **async) */ static void _pipe_async_free(struct k_pipe_async *async) { - k_stack_push(pipe_async_msgs, (uint32_t)async); + k_stack_push(&pipe_async_msgs, (uint32_t)async); } /**