coccinelle: standardize kernel API timeout arguments
Use the int_literal_to_timeout Coccinelle script to convert literal integer arguments for kernel API timeout parameters to the standard timeout value representations. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
0e5329331b
commit
ab91eef23b
48 changed files with 160 additions and 133 deletions
|
@ -35,7 +35,7 @@ osEventFlagsId_t osEventFlagsNew(const osEventFlagsAttr_t *attr)
|
|||
attr = &init_event_flags_attrs;
|
||||
}
|
||||
|
||||
if (k_mem_slab_alloc(&cv2_event_flags_slab, (void **)&events, 100)
|
||||
if (k_mem_slab_alloc(&cv2_event_flags_slab, (void **)&events, K_MSEC(100))
|
||||
== 0) {
|
||||
memset(events, 0, sizeof(struct cv2_event_flags));
|
||||
} else {
|
||||
|
|
|
@ -45,7 +45,7 @@ osMemoryPoolId_t osMemoryPoolNew(uint32_t block_count, uint32_t block_size,
|
|||
attr = &init_mslab_attrs;
|
||||
}
|
||||
|
||||
if (k_mem_slab_alloc(&cv2_mem_slab, (void **)&mslab, 100) == 0) {
|
||||
if (k_mem_slab_alloc(&cv2_mem_slab, (void **)&mslab, K_MSEC(100)) == 0) {
|
||||
(void)memset(mslab, 0, sizeof(struct cv2_mslab));
|
||||
} else {
|
||||
return NULL;
|
||||
|
|
|
@ -43,7 +43,7 @@ osMessageQueueId_t osMessageQueueNew(uint32_t msg_count, uint32_t msg_size,
|
|||
attr = &init_msgq_attrs;
|
||||
}
|
||||
|
||||
if (k_mem_slab_alloc(&cv2_msgq_slab, (void **)&msgq, 100) == 0) {
|
||||
if (k_mem_slab_alloc(&cv2_msgq_slab, (void **)&msgq, K_MSEC(100)) == 0) {
|
||||
(void)memset(msgq, 0, sizeof(struct cv2_msgq));
|
||||
} else {
|
||||
return NULL;
|
||||
|
|
|
@ -38,7 +38,7 @@ osMutexId_t osMutexNew(const osMutexAttr_t *attr)
|
|||
__ASSERT(!(attr->attr_bits & osMutexRobust),
|
||||
"Zephyr does not support osMutexRobust.\n");
|
||||
|
||||
if (k_mem_slab_alloc(&cv2_mutex_slab, (void **)&mutex, 100) == 0) {
|
||||
if (k_mem_slab_alloc(&cv2_mutex_slab, (void **)&mutex, K_MSEC(100)) == 0) {
|
||||
memset(mutex, 0, sizeof(struct cv2_mutex));
|
||||
} else {
|
||||
return NULL;
|
||||
|
|
|
@ -34,7 +34,7 @@ osSemaphoreId_t osSemaphoreNew(uint32_t max_count, uint32_t initial_count,
|
|||
}
|
||||
|
||||
if (k_mem_slab_alloc(&cv2_semaphore_slab,
|
||||
(void **)&semaphore, 100) == 0) {
|
||||
(void **)&semaphore, K_MSEC(100)) == 0) {
|
||||
(void)memset(semaphore, 0, sizeof(struct cv2_sem));
|
||||
} else {
|
||||
return NULL;
|
||||
|
|
|
@ -50,7 +50,7 @@ osTimerId_t osTimerNew(osTimerFunc_t func, osTimerType_t type,
|
|||
attr = &init_timer_attrs;
|
||||
}
|
||||
|
||||
if (k_mem_slab_alloc(&cv2_timer_slab, (void **)&timer, 100) == 0) {
|
||||
if (k_mem_slab_alloc(&cv2_timer_slab, (void **)&timer, K_MSEC(100)) == 0) {
|
||||
(void)memset(timer, 0, sizeof(struct cv2_timer));
|
||||
} else {
|
||||
return NULL;
|
||||
|
@ -90,9 +90,9 @@ osStatus_t osTimerStart(osTimerId_t timer_id, uint32_t ticks)
|
|||
}
|
||||
|
||||
if (timer->type == osTimerOnce) {
|
||||
k_timer_start(&timer->z_timer, millisec, 0);
|
||||
k_timer_start(&timer->z_timer, millisec, K_NO_WAIT);
|
||||
} else if (timer->type == osTimerPeriodic) {
|
||||
k_timer_start(&timer->z_timer, 0, millisec);
|
||||
k_timer_start(&timer->z_timer, K_NO_WAIT, millisec);
|
||||
}
|
||||
|
||||
timer->status = ACTIVE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue