brintos

brintos / linux-shallow public Read only

0
0
Text · 1.5 KiB · 19ccbf4 Raw
68 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2#ifndef __ASM_GENERIC_IRQFLAGS_H3#define __ASM_GENERIC_IRQFLAGS_H4 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_DISABLED10#define ARCH_IRQ_DISABLED 011#define ARCH_IRQ_ENABLED 112#endif13 14/* read interrupt enabled status */15#ifndef arch_local_save_flags16unsigned long arch_local_save_flags(void);17#endif18 19/* set interrupt enabled status */20#ifndef arch_local_irq_restore21void arch_local_irq_restore(unsigned long flags);22#endif23 24/* get status and disable interrupts */25#ifndef arch_local_irq_save26static inline unsigned long arch_local_irq_save(void)27{28	unsigned long flags;29	flags = arch_local_save_flags();30	arch_local_irq_restore(ARCH_IRQ_DISABLED);31	return flags;32}33#endif34 35/* test flags */36#ifndef arch_irqs_disabled_flags37static inline int arch_irqs_disabled_flags(unsigned long flags)38{39	return flags == ARCH_IRQ_DISABLED;40}41#endif42 43/* unconditionally enable interrupts */44#ifndef arch_local_irq_enable45static inline void arch_local_irq_enable(void)46{47	arch_local_irq_restore(ARCH_IRQ_ENABLED);48}49#endif50 51/* unconditionally disable interrupts */52#ifndef arch_local_irq_disable53static inline void arch_local_irq_disable(void)54{55	arch_local_irq_restore(ARCH_IRQ_DISABLED);56}57#endif58 59/* test hardware interrupt enable bit */60#ifndef arch_irqs_disabled61static inline int arch_irqs_disabled(void)62{63	return arch_irqs_disabled_flags(arch_local_save_flags());64}65#endif66 67#endif /* __ASM_GENERIC_IRQFLAGS_H */68