Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/spinlock.h
| Show First 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | _atomic_dec_and_lock_irqsave(atomic_t *cnt, spinlock_t *lock, | ||||
| spin_lock_irqsave(lock, *flags); | spin_lock_irqsave(lock, *flags); | ||||
| if (atomic_dec_and_test(cnt)) | if (atomic_dec_and_test(cnt)) | ||||
| return (1); | return (1); | ||||
| spin_unlock_irqrestore(lock, *flags); | spin_unlock_irqrestore(lock, *flags); | ||||
| return (0); | return (0); | ||||
| } | } | ||||
| /* | |||||
| * struct raw_spinlock | |||||
| */ | |||||
| typedef struct raw_spinlock { | |||||
| struct mtx lock; | |||||
| } raw_spinlock_t; | |||||
| #define raw_spin_lock_init(rlock) \ | |||||
| mtx_init(&(rlock)->lock, spin_lock_name("lnxspin_raw"), \ | |||||
| NULL, MTX_DEF | MTX_NOWITNESS | MTX_NEW) | |||||
| #define raw_spin_lock(rl) spin_lock(&(rl)->lock) | |||||
| #define raw_spin_trylock(rl) spin_trylock(&(rl)->lock) | |||||
| #define raw_spin_unlock(rl) spin_unlock(&(rl)->lock) | |||||
| #define raw_spin_lock_irqsave(rl, f) spin_lock_irqsave(&(rl)->lock, (f)) | |||||
| #define raw_spin_trylock_irqsave(rl, f) spin_trylock_irqsave(&(rl)->lock, (f)) | |||||
| #define raw_spin_unlock_irqrestore(rl, f) spin_unlock_irqrestore(&(rl)->lock, (f)) | |||||
| #endif /* _LINUXKPI_LINUX_SPINLOCK_H_ */ | #endif /* _LINUXKPI_LINUX_SPINLOCK_H_ */ | ||||