unified: fix some leftover K_<obj>_DEFINE macros

The K_<obj>_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 <benjamin.walsh@windriver.com>
This commit is contained in:
Benjamin Walsh 2016-09-15 17:16:38 -04:00
commit 0bee91dae1
3 changed files with 10 additions and 15 deletions

View file

@ -343,9 +343,7 @@ extern void *k_fifo_get(struct k_fifo *fifo, int32_t timeout);
} }
#define K_FIFO_DEFINE(name) \ #define K_FIFO_DEFINE(name) \
struct k_fifo _k_fifo_obj_##name = \ struct k_fifo name = K_FIFO_INITIALIZER(name)
K_FIFO_INITIALIZER(_k_fifo_obj_##name); \
struct k_fifo * const name = &_k_fifo_obj_##name
/* lifos */ /* lifos */
@ -368,9 +366,7 @@ extern void *k_lifo_get(struct k_lifo *lifo, int32_t timeout);
} }
#define K_LIFO_DEFINE(name) \ #define K_LIFO_DEFINE(name) \
struct k_lifo _k_lifo_obj_##name = \ struct k_lifo name = K_LIFO_INITIALIZER(name)
K_LIFO_INITIALIZER(_k_lifo_obj_##name); \
struct k_lifo * const name = &_k_lifo_obj_##name
/* stacks */ /* 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) \ #define K_STACK_DEFINE(name, stack_num_entries) \
uint32_t __noinit _k_stack_buf_##name[stack_num_entries]; \ uint32_t __noinit _k_stack_buf_##name[stack_num_entries]; \
struct k_stack _k_stack_obj_##name = \ struct k_stack name = \
K_STACK_INITIALIZER(_k_stack_obj_##name, stack_num_entries, \ K_STACK_INITIALIZER(name, stack_num_entries, \
_k_stack_buf_##name); \ _k_stack_buf_##name); \
struct k_stack * const name = &_k_stack_obj_##name
#define K_STACK_SIZE(stack_num_entries) \ #define K_STACK_SIZE(stack_num_entries) \
(sizeof(struct k_stack) + (stack_num_entries * sizeof(uint32_t))) (sizeof(struct k_stack) + (stack_num_entries * sizeof(uint32_t)))

View file

@ -61,7 +61,7 @@ void _k_mbox_init(void)
for (i = 0; i < CONFIG_NUM_MBOX_ASYNC_MSGS; i++) { for (i = 0; i < CONFIG_NUM_MBOX_ASYNC_MSGS; i++) {
async_msg[i].thread.flags = K_DUMMY; 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) 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) 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 #endif

View file

@ -68,7 +68,7 @@ void _k_pipes_init(void)
for (int i = 0; i < CONFIG_NUM_PIPE_ASYNC_MSGS; i++) { for (int i = 0; i < CONFIG_NUM_PIPE_ASYNC_MSGS; i++) {
async_msg[i].thread.flags = K_DUMMY; async_msg[i].thread.flags = K_DUMMY;
async_msg[i].thread.swap_data = &async_msg[i].desc; 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) 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) 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);
} }
/** /**