Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Andrew Morton | 676dcb8 | 2006-12-06 20:31:30 -0800 | [diff] [blame] | 2 | #ifndef _LINUX_BH_H |
| 3 | #define _LINUX_BH_H |
| 4 | |
Stephen Rothwell | e52340d | 2021-11-08 18:32:43 -0800 | [diff] [blame] | 5 | #include <linux/instruction_pointer.h> |
Peter Zijlstra | 0bd3a17 | 2013-11-19 16:13:38 +0100 | [diff] [blame] | 6 | #include <linux/preempt.h> |
Peter Zijlstra | 0bd3a17 | 2013-11-19 16:13:38 +0100 | [diff] [blame] | 7 | |
Thomas Gleixner | 8b1c04a | 2021-03-09 09:55:56 +0100 | [diff] [blame] | 8 | #if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_TRACE_IRQFLAGS) |
Peter Zijlstra | 0bd3a17 | 2013-11-19 16:13:38 +0100 | [diff] [blame] | 9 | extern void __local_bh_disable_ip(unsigned long ip, unsigned int cnt); |
| 10 | #else |
| 11 | static __always_inline void __local_bh_disable_ip(unsigned long ip, unsigned int cnt) |
| 12 | { |
| 13 | preempt_count_add(cnt); |
| 14 | barrier(); |
| 15 | } |
| 16 | #endif |
| 17 | |
| 18 | static inline void local_bh_disable(void) |
| 19 | { |
| 20 | __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET); |
| 21 | } |
| 22 | |
Andrew Morton | 676dcb8 | 2006-12-06 20:31:30 -0800 | [diff] [blame] | 23 | extern void _local_bh_enable(void); |
Peter Zijlstra | 0bd3a17 | 2013-11-19 16:13:38 +0100 | [diff] [blame] | 24 | extern void __local_bh_enable_ip(unsigned long ip, unsigned int cnt); |
| 25 | |
| 26 | static inline void local_bh_enable_ip(unsigned long ip) |
| 27 | { |
| 28 | __local_bh_enable_ip(ip, SOFTIRQ_DISABLE_OFFSET); |
| 29 | } |
| 30 | |
| 31 | static inline void local_bh_enable(void) |
| 32 | { |
| 33 | __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET); |
| 34 | } |
Andrew Morton | 676dcb8 | 2006-12-06 20:31:30 -0800 | [diff] [blame] | 35 | |
Thomas Gleixner | 47c218dc | 2021-03-09 09:55:57 +0100 | [diff] [blame] | 36 | #ifdef CONFIG_PREEMPT_RT |
| 37 | extern bool local_bh_blocked(void); |
| 38 | #else |
| 39 | static inline bool local_bh_blocked(void) { return false; } |
| 40 | #endif |
| 41 | |
Andrew Morton | 676dcb8 | 2006-12-06 20:31:30 -0800 | [diff] [blame] | 42 | #endif /* _LINUX_BH_H */ |