spinlock: Add spin_lock_init macro like Linux

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-10-04 23:39:56 +08:00 committed by Alan Carvalho de Assis
parent dfa0283d83
commit c775ee1002
1 changed files with 18 additions and 0 deletions

View File

@ -152,6 +152,24 @@ static inline spinlock_t up_testset(FAR volatile spinlock_t *lock)
}
#endif
/****************************************************************************
* Name: spin_lock_init
*
* Description:
* Initialize a non-reentrant spinlock object to its initial,
* unlocked state.
*
* Input Parameters:
* lock - A reference to the spinlock object to be initialized.
*
* Returned Value:
* None.
*
****************************************************************************/
/* void spin_lock_init(FAR spinlock_t *lock); */
#define spin_lock_init(l) do { *(l) = SP_UNLOCKED; } while (0)
/****************************************************************************
* Name: spin_lock
*