diff --git a/include/nuttx/spinlock.h b/include/nuttx/spinlock.h index ad034fa650..080f73d4c3 100644 --- a/include/nuttx/spinlock.h +++ b/include/nuttx/spinlock.h @@ -227,7 +227,7 @@ void spin_unlockr(FAR struct spinlock_s *lock); * Name: spin_islocked * * Description: - * Release one count on a renonentrant spinlock. + * Release one count on a non-reentrant spinlock. * * Input Parameters: * lock - A reference to the spinlock object to test. @@ -238,7 +238,7 @@ void spin_unlockr(FAR struct spinlock_s *lock); ****************************************************************************/ /* bool spin_islocked(FAR spinlock_t lock); */ -#define spin_islocked(l) ((l) == SP_UNLOCKED) +#define spin_islocked(l) ((l) == SP_LOCKED) /**************************************************************************** * Name: spin_islockedr @@ -255,7 +255,7 @@ void spin_unlockr(FAR struct spinlock_s *lock); ****************************************************************************/ /* bool spin_islockedr(FAR struct spinlock_s *lock); */ -#define spin_islockedr(l) ((l)->sp_lock == SP_UNLOCKED) +#define spin_islockedr(l) ((l)->sp_lock == SP_LOCKED) #endif /* CONFIG_SPINLOCK */ #endif /* __INCLUDE_NUTTX_SPINLOCK_H */ diff --git a/sched/sched/sched_removereadytorun.c b/sched/sched/sched_removereadytorun.c index a844af73d7..847b40f73b 100644 --- a/sched/sched/sched_removereadytorun.c +++ b/sched/sched/sched_removereadytorun.c @@ -74,7 +74,6 @@ bool sched_removereadytorun(FAR struct tcb_s *rtcb) { - FAR struct tcb_s *ntcb = NULL; FAR dq_queue_t *tasklist; bool ret = false; @@ -94,19 +93,19 @@ bool sched_removereadytorun(FAR struct tcb_s *rtcb) * occur. */ - if (!rtcb->blink || TLIST_ISRUNNABLE(rtcb->task_state)) + if (rtcb->blink == NULL && TLIST_ISRUNNABLE(rtcb->task_state)) #else /* There is only one list, g_readytorun, and it always contains the * currently running task. If we are removing the head of this list, * then we are removing the currently active task. */ - if (!rtcb->blink) + if (rtcb->blink == NULL) #endif { /* There must always be at least one task in the list (the idle task) */ - ntcb = (FAR struct tcb_s *)rtcb->flink; + FAR struct tcb_s *ntcb = (FAR struct tcb_s *)rtcb->flink; DEBUGASSERT(ntcb != NULL); #ifdef CONFIG_SMP