- spin_lock_irqsave(spinlock_t *lock, unsigned long flags);
- spin_lock_irq(spinlock_t *lock);
- spin_lock_bh(spinlock_t *lock);
-
Obtains the given lock and prevents the execution of bottom halves.
- spin_unlock(spinlock_t *lock);
- spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags);
- spin_unlock_irq(spinlock_t *lock);
- spin_unlock_bh(spinlock_t *lock);
-
These functions are the counterparts of the various locking primitives described previously. spin_unlock unlocks the given lock and nothing else. spin_unlock_irqrestore possibly enables interrupts, depending on the flags value (which should have come from spin_lock_irqsave). spin_unlock_irq enables interrupts unconditionally, and spin_unlock_bh reenables bottom-half processing. In each case, your function should be in possession of the lock before calling one of the unlocking primitives, or serious disorder will result.
- spin_is_locked(spinlock_t *lock);
- spin_trylock(spinlock_t *lock)
- spin_unlock_wait(spinlock_t *lock);
-
spin_is_locked queries the state of a spinlock without changing it. It returns nonzero if the lock is currently busy. To attempt to acquire a lock without waiting, use spin_trylock, which returns nonzero if the operation failed (the lock was busy). spin_unlock_wait waits until the lock becomes free, but does not take possession of it.