split dev_queue
[cor.git] / include / asm-generic / irqflags.h
blob19ccbf483a2403184b2eaaa9d21c809afd97bc4e
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_GENERIC_IRQFLAGS_H
3 #define __ASM_GENERIC_IRQFLAGS_H
5 /*
6 * All architectures should implement at least the first two functions,
7 * usually inline assembly will be the best way.
8 */
9 #ifndef ARCH_IRQ_DISABLED
10 #define ARCH_IRQ_DISABLED 0
11 #define ARCH_IRQ_ENABLED 1
12 #endif
14 /* read interrupt enabled status */
15 #ifndef arch_local_save_flags
16 unsigned long arch_local_save_flags(void);
17 #endif
19 /* set interrupt enabled status */
20 #ifndef arch_local_irq_restore
21 void arch_local_irq_restore(unsigned long flags);
22 #endif
24 /* get status and disable interrupts */
25 #ifndef arch_local_irq_save
26 static inline unsigned long arch_local_irq_save(void)
28 unsigned long flags;
29 flags = arch_local_save_flags();
30 arch_local_irq_restore(ARCH_IRQ_DISABLED);
31 return flags;
33 #endif
35 /* test flags */
36 #ifndef arch_irqs_disabled_flags
37 static inline int arch_irqs_disabled_flags(unsigned long flags)
39 return flags == ARCH_IRQ_DISABLED;
41 #endif
43 /* unconditionally enable interrupts */
44 #ifndef arch_local_irq_enable
45 static inline void arch_local_irq_enable(void)
47 arch_local_irq_restore(ARCH_IRQ_ENABLED);
49 #endif
51 /* unconditionally disable interrupts */
52 #ifndef arch_local_irq_disable
53 static inline void arch_local_irq_disable(void)
55 arch_local_irq_restore(ARCH_IRQ_DISABLED);
57 #endif
59 /* test hardware interrupt enable bit */
60 #ifndef arch_irqs_disabled
61 static inline int arch_irqs_disabled(void)
63 return arch_irqs_disabled_flags(arch_local_save_flags());
65 #endif
67 #endif /* __ASM_GENERIC_IRQFLAGS_H */