spinlock: Remove atomic.h inclusion in spinlock_type.h
Since the spinlock_type.h is designed to avoid including atomic.h in the userspace, we should remove `atomic.h` inclusion in spinlock_type.h. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit is contained in:
parent
d9bbdeb6fe
commit
42ebe289b0
2 changed files with 6 additions and 10 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,10 +29,6 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#if defined(CONFIG_RW_SPINLOCK) || defined(CONFIG_TICKET_SPINLOCK)
|
||||
#include <nuttx/atomic.h>
|
||||
#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}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue