0001
0002 #ifndef _LINUX_BH_H
0003 #define _LINUX_BH_H
0004
0005 #include <linux/instruction_pointer.h>
0006 #include <linux/preempt.h>
0007
0008 #if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_TRACE_IRQFLAGS)
0009 extern void __local_bh_disable_ip(unsigned long ip, unsigned int cnt);
0010 #else
0011 static __always_inline void __local_bh_disable_ip(unsigned long ip, unsigned int cnt)
0012 {
0013 preempt_count_add(cnt);
0014 barrier();
0015 }
0016 #endif
0017
0018 static inline void local_bh_disable(void)
0019 {
0020 __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
0021 }
0022
0023 extern void _local_bh_enable(void);
0024 extern void __local_bh_enable_ip(unsigned long ip, unsigned int cnt);
0025
0026 static inline void local_bh_enable_ip(unsigned long ip)
0027 {
0028 __local_bh_enable_ip(ip, SOFTIRQ_DISABLE_OFFSET);
0029 }
0030
0031 static inline void local_bh_enable(void)
0032 {
0033 __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
0034 }
0035
0036 #ifdef CONFIG_PREEMPT_RT
0037 extern bool local_bh_blocked(void);
0038 #else
0039 static inline bool local_bh_blocked(void) { return false; }
0040 #endif
0041
0042 #endif