To initialize a spinlock in kernel v4.19-rc5 one must use the spin_lock_init
macro defined as follows:
#define spin_lock_init(_lock) \
do { \
spinlock_check(_lock); \
raw_spin_lock_init(&(_lock)->rlock); \
} while (0)
The function spinlock_check(_lock)
just return &lock->rlock
. This article explains that:
The implementation of the spinlock_check is pretty easy, this function just returns the raw_spinlock_t of the given spinlock to be sure that we got exactly normal raw spinlockI dont't understand how this function performs a check. I was expecting some
if
statements in a ckeck function. I'm sorry but I'm new to kernel programming.