arch: move up_interrupt_context to arch specific irq.h

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2024-03-21 09:57:05 +08:00 committed by archer
parent a754c517cc
commit 6a3a32b185
10 changed files with 99 additions and 39 deletions

View File

@ -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
****************************************************************************/

View File

@ -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
****************************************************************************/

View File

@ -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
****************************************************************************/

View File

@ -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
****************************************************************************/

View File

@ -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
****************************************************************************/

View File

@ -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
****************************************************************************/

View File

@ -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
****************************************************************************/

View File

@ -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

View File

@ -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
****************************************************************************/

View File

@ -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