diff --git a/mm/mm_heap/mm_malloc.c b/mm/mm_heap/mm_malloc.c index 6d39ef2b32..c8c12a974d 100644 --- a/mm/mm_heap/mm_malloc.c +++ b/mm/mm_heap/mm_malloc.c @@ -47,12 +47,12 @@ static void free_delaylist(FAR struct mm_heap_s *heap) /* Move the delay list to local */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(NULL); tmp = heap->mm_delaylist[up_cpu_index()]; heap->mm_delaylist[up_cpu_index()] = NULL; - leave_critical_section(flags); + spin_unlock_irqrestore(NULL, flags); /* Test if the delayed is empty */ diff --git a/sched/timer/timer_create.c b/sched/timer/timer_create.c index e9bd4dcf4b..315d771d2b 100644 --- a/sched/timer/timer_create.c +++ b/sched/timer/timer_create.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "timer/timer.h" @@ -59,10 +60,10 @@ static FAR struct posix_timer_s *timer_allocate(void) /* Try to get a preallocated timer from the free list */ #if CONFIG_PREALLOC_TIMERS > 0 - flags = enter_critical_section(); + flags = spin_lock_irqsave(NULL); ret = (FAR struct posix_timer_s *) sq_remfirst((FAR sq_queue_t *)&g_freetimers); - leave_critical_section(flags); + spin_unlock_irqrestore(NULL, flags); /* Did we get one? */ @@ -91,9 +92,9 @@ static FAR struct posix_timer_s *timer_allocate(void) /* And add it to the end of the list of allocated timers */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(NULL); sq_addlast((FAR sq_entry_t *)ret, (FAR sq_queue_t *)&g_alloctimers); - leave_critical_section(flags); + spin_unlock_irqrestore(NULL, flags); } return ret; diff --git a/sched/timer/timer_release.c b/sched/timer/timer_release.c index bfd85b6564..0b922f0f87 100644 --- a/sched/timer/timer_release.c +++ b/sched/timer/timer_release.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "timer/timer.h" @@ -54,7 +55,7 @@ static inline void timer_free(struct posix_timer_s *timer) /* Remove the timer from the allocated list */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(NULL); sq_rem((FAR sq_entry_t *)timer, (FAR sq_queue_t *)&g_alloctimers); /* Return it to the free list if it is one of the preallocated timers */ @@ -63,14 +64,14 @@ static inline void timer_free(struct posix_timer_s *timer) if ((timer->pt_flags & PT_FLAGS_PREALLOCATED) != 0) { sq_addlast((FAR sq_entry_t *)timer, (FAR sq_queue_t *)&g_freetimers); - leave_critical_section(flags); + spin_unlock_irqrestore(NULL, flags); } else #endif { /* Otherwise, return it to the heap */ - leave_critical_section(flags); + spin_unlock_irqrestore(NULL, flags); kmm_free(timer); } }