summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorHenson <[email protected]>2022-01-26 21:39:06 +0800
committerHenson <[email protected]>2022-01-26 21:39:06 +0800
commit500d26c2570bb3d905e38aed05fd9c9b324a8f6e (patch)
tree6b24159e6e081cfbe42963ee8f9a901538f90637 /components
parent9b44535740b7e1deda584e8c7397b40113fa43f0 (diff)
optimize code
Diffstat (limited to 'components')
-rw-r--r--components/drivers/ipc/completion.c8
-rw-r--r--components/drivers/ipc/dataqueue.c10
-rw-r--r--components/drivers/ipc/waitqueue.c2
3 files changed, 4 insertions, 16 deletions
diff --git a/components/drivers/ipc/completion.c b/components/drivers/ipc/completion.c
index 4983327e1d..84dfb740b1 100644
--- a/components/drivers/ipc/completion.c
+++ b/components/drivers/ipc/completion.c
@@ -58,10 +58,7 @@ rt_err_t rt_completion_wait(struct rt_completion *completion,
RT_ASSERT(completion != RT_NULL);
/* current context checking */
- if (timeout != 0)
- {
- RT_DEBUG_SCHEDULER_AVAILABLE;
- }
+ RT_DEBUG_SCHEDULER_AVAILABLE(timeout != 0);
result = RT_EOK;
thread = rt_thread_self();
@@ -88,9 +85,6 @@ rt_err_t rt_completion_wait(struct rt_completion *completion,
rt_list_insert_before(&(completion->suspended_list),
&(thread->tlist));
- /* current context checking */
- RT_DEBUG_NOT_IN_INTERRUPT;
-
/* start timer */
if (timeout > 0)
{
diff --git a/components/drivers/ipc/dataqueue.c b/components/drivers/ipc/dataqueue.c
index fc77f83922..94e7b087c5 100644
--- a/components/drivers/ipc/dataqueue.c
+++ b/components/drivers/ipc/dataqueue.c
@@ -99,10 +99,7 @@ rt_err_t rt_data_queue_push(struct rt_data_queue *queue,
RT_ASSERT(queue->magic == DATAQUEUE_MAGIC);
/* current context checking */
- if (timeout != 0)
- {
- RT_DEBUG_SCHEDULER_AVAILABLE;
- }
+ RT_DEBUG_SCHEDULER_AVAILABLE(timeout != 0);
result = RT_EOK;
thread = rt_thread_self();
@@ -221,10 +218,7 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue,
RT_ASSERT(size != RT_NULL);
/* current context checking */
- if (timeout != 0)
- {
- RT_DEBUG_SCHEDULER_AVAILABLE;
- }
+ RT_DEBUG_SCHEDULER_AVAILABLE(timeout != 0);
result = RT_EOK;
thread = rt_thread_self();
diff --git a/components/drivers/ipc/waitqueue.c b/components/drivers/ipc/waitqueue.c
index f65b34cdcf..7847c6dde2 100644
--- a/components/drivers/ipc/waitqueue.c
+++ b/components/drivers/ipc/waitqueue.c
@@ -129,7 +129,7 @@ int rt_wqueue_wait(rt_wqueue_t *queue, int condition, int msec)
rt_base_t level;
/* current context checking */
- RT_DEBUG_SCHEDULER_AVAILABLE;
+ RT_DEBUG_SCHEDULER_AVAILABLE(RT_TRUE);
tick = rt_tick_from_millisecond(msec);