diff --git a/arch/arm/include/arm/irq.h b/arch/arm/include/arm/irq.h index eb0450ab8d..a3321d7c62 100644 --- a/arch/arm/include/arm/irq.h +++ b/arch/arm/include/arm/irq.h @@ -267,6 +267,22 @@ static inline_function void up_set_current_regs(uint32_t *regs) g_current_regs[up_cpu_index()] = regs; } +noinstrument_function +static inline_function bool up_interrupt_context(void) +{ +#ifdef CONFIG_SMP + irqstate_t flags = up_irq_save(); +#endif + + bool ret = up_current_regs() != NULL; + +#ifdef CONFIG_SMP + up_irq_restore(flags); +#endif + + return ret; +} + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ diff --git a/arch/arm/include/armv6-m/irq.h b/arch/arm/include/armv6-m/irq.h index cc6fc4fd86..ee40eb119b 100644 --- a/arch/arm/include/armv6-m/irq.h +++ b/arch/arm/include/armv6-m/irq.h @@ -391,6 +391,22 @@ static inline_function void up_set_current_regs(uint32_t *regs) g_current_regs[up_cpu_index()] = regs; } +noinstrument_function +static inline_function bool up_interrupt_context(void) +{ +#ifdef CONFIG_SMP + irqstate_t flags = up_irq_save(); +#endif + + bool ret = up_current_regs() != NULL; + +#ifdef CONFIG_SMP + up_irq_restore(flags); +#endif + + return ret; +} + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ diff --git a/arch/arm/include/armv7-a/irq.h b/arch/arm/include/armv7-a/irq.h index 61c28ef069..c7876f5f4f 100644 --- a/arch/arm/include/armv7-a/irq.h +++ b/arch/arm/include/armv7-a/irq.h @@ -519,6 +519,12 @@ static inline_function void up_set_current_regs(uint32_t *regs) ); } +noinstrument_function +static inline_function bool up_interrupt_context(void) +{ + return up_current_regs() != NULL; +} + /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/arch/arm/include/armv7-m/irq.h b/arch/arm/include/armv7-m/irq.h index 333b95d3ad..53900703b7 100644 --- a/arch/arm/include/armv7-m/irq.h +++ b/arch/arm/include/armv7-m/irq.h @@ -596,6 +596,22 @@ static inline_function void up_set_current_regs(uint32_t *regs) g_current_regs[up_cpu_index()] = regs; } +noinstrument_function +static inline_function bool up_interrupt_context(void) +{ +#ifdef CONFIG_SMP + irqstate_t flags = up_irq_save(); +#endif + + bool ret = up_current_regs() != NULL; + +#ifdef CONFIG_SMP + up_irq_restore(flags); +#endif + + return ret; +} + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ diff --git a/arch/arm/include/armv7-r/irq.h b/arch/arm/include/armv7-r/irq.h index fb2e684f82..1b6d6e1b46 100644 --- a/arch/arm/include/armv7-r/irq.h +++ b/arch/arm/include/armv7-r/irq.h @@ -501,6 +501,12 @@ static inline_function void up_set_current_regs(uint32_t *regs) ); } +noinstrument_function +static inline_function bool up_interrupt_context(void) +{ + return up_current_regs() != NULL; +} + /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/arch/arm/include/armv8-m/irq.h b/arch/arm/include/armv8-m/irq.h index 4148f07644..69763c8664 100644 --- a/arch/arm/include/armv8-m/irq.h +++ b/arch/arm/include/armv8-m/irq.h @@ -569,6 +569,22 @@ static inline_function void up_set_current_regs(uint32_t *regs) g_current_regs[up_cpu_index()] = regs; } +noinstrument_function +static inline_function bool up_interrupt_context(void) +{ +#ifdef CONFIG_SMP + irqstate_t flags = up_irq_save(); +#endif + + bool ret = up_current_regs() != NULL; + +#ifdef CONFIG_SMP + up_irq_restore(flags); +#endif + + return ret; +} + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ diff --git a/arch/arm/include/armv8-r/irq.h b/arch/arm/include/armv8-r/irq.h index 4b7f7ac63e..53fb064d84 100644 --- a/arch/arm/include/armv8-r/irq.h +++ b/arch/arm/include/armv8-r/irq.h @@ -501,6 +501,12 @@ static inline_function void up_set_current_regs(uint32_t *regs) ); } +noinstrument_function +static inline_function bool up_interrupt_context(void) +{ + return up_current_regs() != NULL; +} + /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/arch/arm/include/irq.h b/arch/arm/include/irq.h index c8c3cfd2c5..e859604c6b 100644 --- a/arch/arm/include/irq.h +++ b/arch/arm/include/irq.h @@ -84,34 +84,6 @@ extern "C" #define EXTERN extern #endif -/**************************************************************************** - * Inline functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_interrupt_context - * - * Description: - * Return true is we are currently executing in the interrupt - * handler context. - * - ****************************************************************************/ - -noinstrument_function -static inline bool up_interrupt_context(void) -{ -#ifdef CONFIG_SMP - irqstate_t flags = up_irq_save(); -#endif - - bool ret = up_current_regs() != NULL; - -#ifdef CONFIG_SMP - up_irq_restore(flags); -#endif - - return ret; -} #endif /* __ASSEMBLY__ */ #undef EXTERN diff --git a/arch/arm/include/tlsr82/irq.h b/arch/arm/include/tlsr82/irq.h index 869ddf5bc1..72cb08c9bf 100644 --- a/arch/arm/include/tlsr82/irq.h +++ b/arch/arm/include/tlsr82/irq.h @@ -296,6 +296,22 @@ static inline_function void up_set_current_regs(uint32_t *regs) g_current_regs[up_cpu_index()] = regs; } +noinstrument_function +static inline_function bool up_interrupt_context(void) +{ +#ifdef CONFIG_SMP + irqstate_t flags = up_irq_save(); +#endif + + bool ret = up_current_regs() != NULL; + +#ifdef CONFIG_SMP + up_irq_restore(flags); +#endif + + return ret; +} + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ diff --git a/arch/arm64/include/irq.h b/arch/arm64/include/irq.h index c5d941f467..19ed567ad1 100644 --- a/arch/arm64/include/irq.h +++ b/arch/arm64/include/irq.h @@ -433,17 +433,7 @@ static inline_function void up_set_current_regs(uint64_t *regs) static inline bool up_interrupt_context(void) { -#ifdef CONFIG_SMP - irqstate_t flags = up_irq_save(); -#endif - - bool ret = (up_current_regs() != NULL); - -#ifdef CONFIG_SMP - up_irq_restore(flags); -#endif - - return ret; + return up_current_regs() != NULL; } #undef EXTERN