LCOV - code coverage report
Current view: top level - include/asm-generic - irqflags.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 3 3 100.0 %
Date: 2023-07-19 18:55:55 Functions: 0 0 -

          Line data    Source code
       1             : /* SPDX-License-Identifier: GPL-2.0 */
       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             :  */
       9             : #ifndef ARCH_IRQ_DISABLED
      10             : #define ARCH_IRQ_DISABLED 0
      11             : #define ARCH_IRQ_ENABLED 1
      12             : #endif
      13             : 
      14             : /* read interrupt enabled status */
      15             : #ifndef arch_local_save_flags
      16             : unsigned long arch_local_save_flags(void);
      17             : #endif
      18             : 
      19             : /* set interrupt enabled status */
      20             : #ifndef arch_local_irq_restore
      21             : void arch_local_irq_restore(unsigned long flags);
      22             : #endif
      23             : 
      24             : /* get status and disable interrupts */
      25             : #ifndef arch_local_irq_save
      26             : static inline unsigned long arch_local_irq_save(void)
      27             : {
      28             :         unsigned long flags;
      29      211827 :         flags = arch_local_save_flags();
      30      211827 :         arch_local_irq_restore(ARCH_IRQ_DISABLED);
      31             :         return flags;
      32             : }
      33             : #endif
      34             : 
      35             : /* test flags */
      36             : #ifndef arch_irqs_disabled_flags
      37             : static inline int arch_irqs_disabled_flags(unsigned long flags)
      38             : {
      39         417 :         return flags == ARCH_IRQ_DISABLED;
      40             : }
      41             : #endif
      42             : 
      43             : /* unconditionally enable interrupts */
      44             : #ifndef arch_local_irq_enable
      45             : static inline void arch_local_irq_enable(void)
      46             : {
      47             :         arch_local_irq_restore(ARCH_IRQ_ENABLED);
      48             : }
      49             : #endif
      50             : 
      51             : /* unconditionally disable interrupts */
      52             : #ifndef arch_local_irq_disable
      53             : static inline void arch_local_irq_disable(void)
      54             : {
      55             :         arch_local_irq_restore(ARCH_IRQ_DISABLED);
      56             : }
      57             : #endif
      58             : 
      59             : /* test hardware interrupt enable bit */
      60             : #ifndef arch_irqs_disabled
      61             : static inline int arch_irqs_disabled(void)
      62             : {
      63             :         return arch_irqs_disabled_flags(arch_local_save_flags());
      64             : }
      65             : #endif
      66             : 
      67             : #endif /* __ASM_GENERIC_IRQFLAGS_H */

Generated by: LCOV version 1.14