]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/asm-generic/irqflags.h
jbd2: Fix possible overflow in jbd2_log_space_left()
[mirror_ubuntu-bionic-kernel.git] / include / asm-generic / irqflags.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
aafe4dbe
AB
2#ifndef __ASM_GENERIC_IRQFLAGS_H
3#define __ASM_GENERIC_IRQFLAGS_H
4
5/*
6 * All architectures should implement at least the first two functions,
7 * usually inline assembly will be the best way.
8 */
df9ee292
DH
9#ifndef ARCH_IRQ_DISABLED
10#define ARCH_IRQ_DISABLED 0
11#define ARCH_IRQ_ENABLED 1
aafe4dbe
AB
12#endif
13
14/* read interrupt enabled status */
df9ee292
DH
15#ifndef arch_local_save_flags
16unsigned long arch_local_save_flags(void);
aafe4dbe
AB
17#endif
18
19/* set interrupt enabled status */
df9ee292
DH
20#ifndef arch_local_irq_restore
21void arch_local_irq_restore(unsigned long flags);
aafe4dbe
AB
22#endif
23
24/* get status and disable interrupts */
df9ee292
DH
25#ifndef arch_local_irq_save
26static inline unsigned long arch_local_irq_save(void)
aafe4dbe
AB
27{
28 unsigned long flags;
df9ee292
DH
29 flags = arch_local_save_flags();
30 arch_local_irq_restore(ARCH_IRQ_DISABLED);
aafe4dbe
AB
31 return flags;
32}
33#endif
34
35/* test flags */
df9ee292
DH
36#ifndef arch_irqs_disabled_flags
37static inline int arch_irqs_disabled_flags(unsigned long flags)
aafe4dbe 38{
df9ee292 39 return flags == ARCH_IRQ_DISABLED;
aafe4dbe
AB
40}
41#endif
42
43/* unconditionally enable interrupts */
df9ee292
DH
44#ifndef arch_local_irq_enable
45static inline void arch_local_irq_enable(void)
aafe4dbe 46{
df9ee292 47 arch_local_irq_restore(ARCH_IRQ_ENABLED);
aafe4dbe
AB
48}
49#endif
50
51/* unconditionally disable interrupts */
df9ee292
DH
52#ifndef arch_local_irq_disable
53static inline void arch_local_irq_disable(void)
aafe4dbe 54{
df9ee292 55 arch_local_irq_restore(ARCH_IRQ_DISABLED);
aafe4dbe
AB
56}
57#endif
58
59/* test hardware interrupt enable bit */
df9ee292
DH
60#ifndef arch_irqs_disabled
61static inline int arch_irqs_disabled(void)
aafe4dbe 62{
df9ee292 63 return arch_irqs_disabled_flags(arch_local_save_flags());
aafe4dbe
AB
64}
65#endif
66
aafe4dbe 67#endif /* __ASM_GENERIC_IRQFLAGS_H */