1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _LINUX_LOCAL_LOCK_H 2 #ifndef _LINUX_LOCAL_LOCK_H 3 #define _LINUX_LOCAL_LOCK_H 3 #define _LINUX_LOCAL_LOCK_H 4 4 5 #include <linux/local_lock_internal.h> 5 #include <linux/local_lock_internal.h> 6 6 7 /** 7 /** 8 * local_lock_init - Runtime initialize a lock 8 * local_lock_init - Runtime initialize a lock instance 9 */ 9 */ 10 #define local_lock_init(lock) __loca 10 #define local_lock_init(lock) __local_lock_init(lock) 11 11 12 /** 12 /** 13 * local_lock - Acquire a per CPU local lock 13 * local_lock - Acquire a per CPU local lock 14 * @lock: The lock variable 14 * @lock: The lock variable 15 */ 15 */ 16 #define local_lock(lock) __loca 16 #define local_lock(lock) __local_lock(lock) 17 17 18 /** 18 /** 19 * local_lock_irq - Acquire a per CPU local lo 19 * local_lock_irq - Acquire a per CPU local lock and disable interrupts 20 * @lock: The lock variable 20 * @lock: The lock variable 21 */ 21 */ 22 #define local_lock_irq(lock) __loca 22 #define local_lock_irq(lock) __local_lock_irq(lock) 23 23 24 /** 24 /** 25 * local_lock_irqsave - Acquire a per CPU loca 25 * local_lock_irqsave - Acquire a per CPU local lock, save and disable 26 * interrupts 26 * interrupts 27 * @lock: The lock variable 27 * @lock: The lock variable 28 * @flags: Storage for interrupt flags 28 * @flags: Storage for interrupt flags 29 */ 29 */ 30 #define local_lock_irqsave(lock, flags) 30 #define local_lock_irqsave(lock, flags) \ 31 __local_lock_irqsave(lock, flags) 31 __local_lock_irqsave(lock, flags) 32 32 33 /** 33 /** 34 * local_unlock - Release a per CPU local lock 34 * local_unlock - Release a per CPU local lock 35 * @lock: The lock variable 35 * @lock: The lock variable 36 */ 36 */ 37 #define local_unlock(lock) __loca 37 #define local_unlock(lock) __local_unlock(lock) 38 38 39 /** 39 /** 40 * local_unlock_irq - Release a per CPU local 40 * local_unlock_irq - Release a per CPU local lock and enable interrupts 41 * @lock: The lock variable 41 * @lock: The lock variable 42 */ 42 */ 43 #define local_unlock_irq(lock) __loca 43 #define local_unlock_irq(lock) __local_unlock_irq(lock) 44 44 45 /** 45 /** 46 * local_unlock_irqrestore - Release a per CPU 46 * local_unlock_irqrestore - Release a per CPU local lock and restore 47 * interrupt flags 47 * interrupt flags 48 * @lock: The lock variable 48 * @lock: The lock variable 49 * @flags: Interrupt flags to restore 49 * @flags: Interrupt flags to restore 50 */ 50 */ 51 #define local_unlock_irqrestore(lock, flags) 51 #define local_unlock_irqrestore(lock, flags) \ 52 __local_unlock_irqrestore(lock, flags) 52 __local_unlock_irqrestore(lock, flags) 53 53 54 DEFINE_GUARD(local_lock, local_lock_t __percpu 54 DEFINE_GUARD(local_lock, local_lock_t __percpu*, 55 local_lock(_T), 55 local_lock(_T), 56 local_unlock(_T)) 56 local_unlock(_T)) 57 DEFINE_GUARD(local_lock_irq, local_lock_t __pe 57 DEFINE_GUARD(local_lock_irq, local_lock_t __percpu*, 58 local_lock_irq(_T), 58 local_lock_irq(_T), 59 local_unlock_irq(_T)) 59 local_unlock_irq(_T)) 60 DEFINE_LOCK_GUARD_1(local_lock_irqsave, local_ 60 DEFINE_LOCK_GUARD_1(local_lock_irqsave, local_lock_t __percpu, 61 local_lock_irqsave(_T->loc 61 local_lock_irqsave(_T->lock, _T->flags), 62 local_unlock_irqrestore(_T 62 local_unlock_irqrestore(_T->lock, _T->flags), 63 unsigned long flags) 63 unsigned long flags) 64 64 65 #define local_lock_nested_bh(_lock) 65 #define local_lock_nested_bh(_lock) \ 66 __local_lock_nested_bh(_lock) 66 __local_lock_nested_bh(_lock) 67 67 68 #define local_unlock_nested_bh(_lock) 68 #define local_unlock_nested_bh(_lock) \ 69 __local_unlock_nested_bh(_lock) 69 __local_unlock_nested_bh(_lock) 70 70 71 DEFINE_GUARD(local_lock_nested_bh, local_lock_ 71 DEFINE_GUARD(local_lock_nested_bh, local_lock_t __percpu*, 72 local_lock_nested_bh(_T), 72 local_lock_nested_bh(_T), 73 local_unlock_nested_bh(_T)) 73 local_unlock_nested_bh(_T)) 74 74 75 #endif 75 #endif 76 76
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.