diff --git a/include/nuttx/spinlock.h b/include/nuttx/spinlock.h index ebca68fbe2..44493a8208 100644 --- a/include/nuttx/spinlock.h +++ b/include/nuttx/spinlock.h @@ -595,8 +595,8 @@ irqstate_t rspin_lock_irqsave(FAR rspinlock_t *lock) /* Try seize the ownership of the lock. */ - while (!atomic_cmpxchg_acquire((atomic_t *)&lock->val, - (atomic_t *)&old_val.val, new_val.val)) + while (!atomic_cmpxchg_acquire((FAR atomic_t *)&lock->val, + (FAR atomic_t *)&old_val.val, new_val.val)) { /* Already owned this lock. */ @@ -821,7 +821,7 @@ void rspin_unlock_irqrestore(FAR rspinlock_t *lock, irqstate_t flags) if (--lock->count == 0) { - atomic_set_release((atomic_t *)&lock->val, 0); + atomic_set_release((FAR atomic_t *)&lock->val, 0); up_irq_restore(flags); } diff --git a/include/nuttx/spinlock_type.h b/include/nuttx/spinlock_type.h index 9d3ac4b34d..0a50c9ed45 100644 --- a/include/nuttx/spinlock_type.h +++ b/include/nuttx/spinlock_type.h @@ -29,10 +29,6 @@ #include -#if defined(CONFIG_RW_SPINLOCK) || defined(CONFIG_TICKET_SPINLOCK) -#include -#endif - #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" @@ -43,7 +39,7 @@ extern "C" #endif #if defined(CONFIG_RW_SPINLOCK) -typedef atomic_t rwlock_t; +typedef uint32_t rwlock_t; # define RW_SP_UNLOCKED 0 # define RW_SP_READ_LOCKED 1 # define RW_SP_WRITE_LOCKED -1 @@ -58,8 +54,8 @@ typedef uint8_t spinlock_t; typedef struct spinlock_s { - atomic_t owner; - atomic_t next; + uint32_t owner; + uint32_t next; } spinlock_t; # define SP_UNLOCKED (spinlock_t){0, 0}