xref: /openbsd-src/sys/dev/pci/drm/include/linux/preempt.h (revision c1a45aed656e7d5627c30c92421893a76f370ccb)
1 /* Public domain. */
2 
3 #ifndef _LINUX_PREEMPT_H
4 #define _LINUX_PREEMPT_H
5 
6 #include <asm/preempt.h>
7 
8 static inline void
9 preempt_enable(void)
10 {
11 }
12 
13 static inline void
14 preempt_disable(void)
15 {
16 }
17 
18 static inline bool
19 in_irq(void)
20 {
21 #if defined(__amd64__) || defined(__arm__) || defined(__arm64__) || \
22     defined(__i386__) || defined(__powerpc64__) || defined(__riscv64__)
23 	return (curcpu()->ci_idepth > 0);
24 #else
25 	return false;
26 #endif
27 }
28 
29 static inline bool
30 in_interrupt(void)
31 {
32 	return in_irq();
33 }
34 
35 static inline bool
36 in_task(void)
37 {
38 	return !in_irq();
39 }
40 
41 static inline bool
42 in_atomic(void)
43 {
44 	return false;
45 }
46 
47 #endif
48