Skip to content

Commit

Permalink
kernel: Name of static functions should not begin with an underscore
Browse files Browse the repository at this point in the history
Names that begin with an underscore are reserved by the C standard.
This patch does not change names of functions defined and implemented
in header files.

Signed-off-by: Leandro Pereira <[email protected]>
  • Loading branch information
lpereira authored and Anas Nashif committed Mar 10, 2018
1 parent fd21249 commit a1ae845
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 74 deletions.
4 changes: 2 additions & 2 deletions kernel/idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static void set_kernel_idle_time_in_ticks(s32_t ticks)
#define set_kernel_idle_time_in_ticks(x) do { } while (0)
#endif

static void _sys_power_save_idle(s32_t ticks)
static void sys_power_save_idle(s32_t ticks)
{
#ifdef CONFIG_TICKLESS_KERNEL
if (ticks != K_FOREVER) {
Expand Down Expand Up @@ -180,7 +180,7 @@ void idle(void *unused1, void *unused2, void *unused3)

for (;;) {
(void)irq_lock();
_sys_power_save_idle(_get_next_timeout_expiry());
sys_power_save_idle(_get_next_timeout_expiry());

IDLE_YIELD_IF_COOP();
}
Expand Down
9 changes: 5 additions & 4 deletions kernel/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,14 @@ void _data_copy(void)

/**
*
* @brief Mainline for kernel's background task
* @brief Mainline for kernel's background thread
*
* This routine completes kernel initialization by invoking the remaining
* init functions, then invokes application's main() routine.
*
* @return N/A
*/
static void _main(void *unused1, void *unused2, void *unused3)
static void bg_thread_main(void *unused1, void *unused2, void *unused3)
{
ARG_UNUSED(unused1);
ARG_UNUSED(unused2);
Expand Down Expand Up @@ -348,7 +348,8 @@ static void prepare_multithreading(struct k_thread *dummy_thread)
#endif

_setup_new_thread(_main_thread, _main_stack,
MAIN_STACK_SIZE, _main, NULL, NULL, NULL,
MAIN_STACK_SIZE, bg_thread_main,
NULL, NULL, NULL,
CONFIG_MAIN_THREAD_PRIORITY, K_ESSENTIAL);
_mark_thread_as_started(_main_thread);
_add_thread_to_ready_q(_main_thread);
Expand Down Expand Up @@ -389,7 +390,7 @@ static void switch_to_main_thread(void)
{
#ifdef CONFIG_ARCH_HAS_CUSTOM_SWAP_TO_MAIN
_arch_switch_to_main_thread(_main_thread, _main_stack, MAIN_STACK_SIZE,
_main);
bg_thread_main);
#else
/*
* Context switch to main task (entry function is _main()): the
Expand Down
38 changes: 19 additions & 19 deletions kernel/mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ static struct k_mbox_async __noinit async_msg[CONFIG_NUM_MBOX_ASYNC_MSGS];
K_STACK_DEFINE(async_msg_free, CONFIG_NUM_MBOX_ASYNC_MSGS);

/* allocate an asynchronous message descriptor */
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, (u32_t *)async, K_FOREVER);
}

/* free an asynchronous message descriptor */
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, (u32_t)async);
}
Expand Down Expand Up @@ -121,7 +121,7 @@ void k_mbox_init(struct k_mbox *mbox_ptr)
*
* @return 0 if successfully matched, otherwise -1.
*/
static int _mbox_message_match(struct k_mbox_msg *tx_msg,
static int mbox_message_match(struct k_mbox_msg *tx_msg,
struct k_mbox_msg *rx_msg)
{
u32_t temp_info;
Expand Down Expand Up @@ -173,7 +173,7 @@ static int _mbox_message_match(struct k_mbox_msg *tx_msg,
*
* @return N/A
*/
static void _mbox_message_dispose(struct k_mbox_msg *rx_msg)
static void mbox_message_dispose(struct k_mbox_msg *rx_msg)
{
struct k_thread *sending_thread;
struct k_mbox_msg *tx_msg;
Expand Down Expand Up @@ -206,7 +206,7 @@ static void _mbox_message_dispose(struct k_mbox_msg *rx_msg)
if (sending_thread->base.thread_state & _THREAD_DUMMY) {
struct k_sem *async_sem = tx_msg->_async_sem;

_mbox_async_free((struct k_mbox_async *)sending_thread);
mbox_async_free((struct k_mbox_async *)sending_thread);
if (async_sem != NULL) {
k_sem_give(async_sem);
}
Expand Down Expand Up @@ -236,7 +236,7 @@ static void _mbox_message_dispose(struct k_mbox_msg *rx_msg)
*
* @return 0 if successful, -ENOMSG if failed immediately, -EAGAIN if timed out
*/
static int _mbox_message_put(struct k_mbox *mbox, struct k_mbox_msg *tx_msg,
static int mbox_message_put(struct k_mbox *mbox, struct k_mbox_msg *tx_msg,
s32_t timeout)
{
struct k_thread *sending_thread;
Expand All @@ -258,7 +258,7 @@ static int _mbox_message_put(struct k_mbox *mbox, struct k_mbox_msg *tx_msg,
next, base.k_q_node) {
rx_msg = (struct k_mbox_msg *)receiving_thread->base.swap_data;

if (_mbox_message_match(tx_msg, rx_msg) == 0) {
if (mbox_message_match(tx_msg, rx_msg) == 0) {
/* take receiver out of rx queue */
_unpend_thread(receiving_thread);
_abort_thread_timeout(receiving_thread);
Expand Down Expand Up @@ -316,7 +316,7 @@ int k_mbox_put(struct k_mbox *mbox, struct k_mbox_msg *tx_msg, s32_t timeout)
/* configure things for a synchronous send, then send the message */
tx_msg->_syncing_thread = _current;

return _mbox_message_put(mbox, tx_msg, timeout);
return mbox_message_put(mbox, tx_msg, timeout);
}

#if (CONFIG_NUM_MBOX_ASYNC_MSGS > 0)
Expand All @@ -329,15 +329,15 @@ void k_mbox_async_put(struct k_mbox *mbox, struct k_mbox_msg *tx_msg,
* allocate an asynchronous message descriptor, configure both parts,
* then send the message asynchronously
*/
_mbox_async_alloc(&async);
mbox_async_alloc(&async);

async->thread.prio = _current->base.prio;

async->tx_msg = *tx_msg;
async->tx_msg._syncing_thread = (struct k_thread *)&async->thread;
async->tx_msg._async_sem = sem;

_mbox_message_put(mbox, &async->tx_msg, K_FOREVER);
mbox_message_put(mbox, &async->tx_msg, K_FOREVER);
}
#endif

Expand All @@ -346,15 +346,15 @@ void k_mbox_data_get(struct k_mbox_msg *rx_msg, void *buffer)
/* handle case where data is to be discarded */
if (buffer == NULL) {
rx_msg->size = 0;
_mbox_message_dispose(rx_msg);
mbox_message_dispose(rx_msg);
return;
}

/* copy message data to buffer, then dispose of message */
if ((rx_msg->tx_data != NULL) && (rx_msg->size > 0)) {
memcpy(buffer, rx_msg->tx_data, rx_msg->size);
}
_mbox_message_dispose(rx_msg);
mbox_message_dispose(rx_msg);
}

int k_mbox_data_block_get(struct k_mbox_msg *rx_msg, struct k_mem_pool *pool,
Expand All @@ -365,7 +365,7 @@ int k_mbox_data_block_get(struct k_mbox_msg *rx_msg, struct k_mem_pool *pool,
/* handle case where data is to be discarded */
if (pool == NULL) {
rx_msg->size = 0;
_mbox_message_dispose(rx_msg);
mbox_message_dispose(rx_msg);
return 0;
}

Expand All @@ -376,7 +376,7 @@ int k_mbox_data_block_get(struct k_mbox_msg *rx_msg, struct k_mem_pool *pool,
rx_msg->tx_block.data = NULL;

/* now dispose of message */
_mbox_message_dispose(rx_msg);
mbox_message_dispose(rx_msg);
return 0;
}

Expand Down Expand Up @@ -407,14 +407,14 @@ int k_mbox_data_block_get(struct k_mbox_msg *rx_msg, struct k_mem_pool *pool,
*
* @return 0
*/
static int _mbox_message_data_check(struct k_mbox_msg *rx_msg, void *buffer)
static int mbox_message_data_check(struct k_mbox_msg *rx_msg, void *buffer)
{
if (buffer != NULL) {
/* retrieve data now, then dispose of message */
k_mbox_data_get(rx_msg, buffer);
} else if (rx_msg->size == 0) {
/* there is no data to get, so just dispose of message */
_mbox_message_dispose(rx_msg);
mbox_message_dispose(rx_msg);
} else {
/* keep message around for later data retrieval */
}
Expand All @@ -441,15 +441,15 @@ int k_mbox_get(struct k_mbox *mbox, struct k_mbox_msg *rx_msg, void *buffer,

tx_msg = (struct k_mbox_msg *)sending_thread->base.swap_data;

if (_mbox_message_match(tx_msg, rx_msg) == 0) {
if (mbox_message_match(tx_msg, rx_msg) == 0) {
/* take sender out of mailbox's tx queue */
_unpend_thread(sending_thread);
_abort_thread_timeout(sending_thread);

irq_unlock(key);

/* consume message data immediately, if needed */
return _mbox_message_data_check(rx_msg, buffer);
return mbox_message_data_check(rx_msg, buffer);
}
}

Expand All @@ -468,7 +468,7 @@ int k_mbox_get(struct k_mbox *mbox, struct k_mbox_msg *rx_msg, void *buffer,

/* consume message data immediately, if needed */
if (result == 0) {
result = _mbox_message_data_check(rx_msg, buffer);
result = mbox_message_data_check(rx_msg, buffer);
}

return result;
Expand Down
Loading

0 comments on commit a1ae845

Please sign in to comment.