bottom_half.h 1013 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _LINUX_BH_H
  3. #define _LINUX_BH_H
  4. #include <linux/instruction_pointer.h>
  5. #include <linux/preempt.h>
  6. #if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_TRACE_IRQFLAGS)
  7. extern void __local_bh_disable_ip(unsigned long ip, unsigned int cnt);
  8. #else
  9. static __always_inline void __local_bh_disable_ip(unsigned long ip, unsigned int cnt)
  10. {
  11. preempt_count_add(cnt);
  12. barrier();
  13. }
  14. #endif
  15. static inline void local_bh_disable(void)
  16. {
  17. __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
  18. }
  19. extern void _local_bh_enable(void);
  20. extern void __local_bh_enable_ip(unsigned long ip, unsigned int cnt);
  21. static inline void local_bh_enable_ip(unsigned long ip)
  22. {
  23. __local_bh_enable_ip(ip, SOFTIRQ_DISABLE_OFFSET);
  24. }
  25. static inline void local_bh_enable(void)
  26. {
  27. __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
  28. }
  29. #ifdef CONFIG_PREEMPT_RT
  30. extern bool local_bh_blocked(void);
  31. #else
  32. static inline bool local_bh_blocked(void) { return false; }
  33. #endif
  34. #endif /* _LINUX_BH_H */