0001 #ifndef __LINUX_SPINLOCK_API_UP_H
0002 #define __LINUX_SPINLOCK_API_UP_H
0003
0004 #ifndef __LINUX_SPINLOCK_H
0005 # error "please don't include this file directly"
0006 #endif
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #define in_lock_functions(ADDR) 0
0018
0019 #define assert_raw_spin_locked(lock) do { (void)(lock); } while (0)
0020
0021
0022
0023
0024
0025
0026
0027 #define ___LOCK(lock) \
0028 do { __acquire(lock); (void)(lock); } while (0)
0029
0030 #define __LOCK(lock) \
0031 do { preempt_disable(); ___LOCK(lock); } while (0)
0032
0033 #define __LOCK_BH(lock) \
0034 do { __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_LOCK_OFFSET); ___LOCK(lock); } while (0)
0035
0036 #define __LOCK_IRQ(lock) \
0037 do { local_irq_disable(); __LOCK(lock); } while (0)
0038
0039 #define __LOCK_IRQSAVE(lock, flags) \
0040 do { local_irq_save(flags); __LOCK(lock); } while (0)
0041
0042 #define ___UNLOCK(lock) \
0043 do { __release(lock); (void)(lock); } while (0)
0044
0045 #define __UNLOCK(lock) \
0046 do { preempt_enable(); ___UNLOCK(lock); } while (0)
0047
0048 #define __UNLOCK_BH(lock) \
0049 do { __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_LOCK_OFFSET); \
0050 ___UNLOCK(lock); } while (0)
0051
0052 #define __UNLOCK_IRQ(lock) \
0053 do { local_irq_enable(); __UNLOCK(lock); } while (0)
0054
0055 #define __UNLOCK_IRQRESTORE(lock, flags) \
0056 do { local_irq_restore(flags); __UNLOCK(lock); } while (0)
0057
0058 #define _raw_spin_lock(lock) __LOCK(lock)
0059 #define _raw_spin_lock_nested(lock, subclass) __LOCK(lock)
0060 #define _raw_read_lock(lock) __LOCK(lock)
0061 #define _raw_write_lock(lock) __LOCK(lock)
0062 #define _raw_write_lock_nested(lock, subclass) __LOCK(lock)
0063 #define _raw_spin_lock_bh(lock) __LOCK_BH(lock)
0064 #define _raw_read_lock_bh(lock) __LOCK_BH(lock)
0065 #define _raw_write_lock_bh(lock) __LOCK_BH(lock)
0066 #define _raw_spin_lock_irq(lock) __LOCK_IRQ(lock)
0067 #define _raw_read_lock_irq(lock) __LOCK_IRQ(lock)
0068 #define _raw_write_lock_irq(lock) __LOCK_IRQ(lock)
0069 #define _raw_spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
0070 #define _raw_read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
0071 #define _raw_write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
0072 #define _raw_spin_trylock(lock) ({ __LOCK(lock); 1; })
0073 #define _raw_read_trylock(lock) ({ __LOCK(lock); 1; })
0074 #define _raw_write_trylock(lock) ({ __LOCK(lock); 1; })
0075 #define _raw_spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; })
0076 #define _raw_spin_unlock(lock) __UNLOCK(lock)
0077 #define _raw_read_unlock(lock) __UNLOCK(lock)
0078 #define _raw_write_unlock(lock) __UNLOCK(lock)
0079 #define _raw_spin_unlock_bh(lock) __UNLOCK_BH(lock)
0080 #define _raw_write_unlock_bh(lock) __UNLOCK_BH(lock)
0081 #define _raw_read_unlock_bh(lock) __UNLOCK_BH(lock)
0082 #define _raw_spin_unlock_irq(lock) __UNLOCK_IRQ(lock)
0083 #define _raw_read_unlock_irq(lock) __UNLOCK_IRQ(lock)
0084 #define _raw_write_unlock_irq(lock) __UNLOCK_IRQ(lock)
0085 #define _raw_spin_unlock_irqrestore(lock, flags) \
0086 __UNLOCK_IRQRESTORE(lock, flags)
0087 #define _raw_read_unlock_irqrestore(lock, flags) \
0088 __UNLOCK_IRQRESTORE(lock, flags)
0089 #define _raw_write_unlock_irqrestore(lock, flags) \
0090 __UNLOCK_IRQRESTORE(lock, flags)
0091
0092 #endif