linux/arch/nds32/include/asm/irqflags.h
Peter Zijlstra 36206b588b nds32: Implement arch_irqs_disabled()
Cc: Nick Hu <nickhu@andestech.com>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Marco Elver <elver@google.com>
Link: https://lkml.kernel.org/r/20200821085348.604899379@infradead.org
2020-08-26 12:41:55 +02:00

42 lines
848 B
C

/* SPDX-License-Identifier: GPL-2.0 */
// Copyright (C) 2005-2017 Andes Technology Corporation
#include <asm/nds32.h>
#include <nds32_intrinsic.h>
#define arch_local_irq_disable() \
GIE_DISABLE();
#define arch_local_irq_enable() \
GIE_ENABLE();
static inline unsigned long arch_local_irq_save(void)
{
unsigned long flags;
flags = __nds32__mfsr(NDS32_SR_PSW) & PSW_mskGIE;
GIE_DISABLE();
return flags;
}
static inline unsigned long arch_local_save_flags(void)
{
unsigned long flags;
flags = __nds32__mfsr(NDS32_SR_PSW) & PSW_mskGIE;
return flags;
}
static inline void arch_local_irq_restore(unsigned long flags)
{
if(flags)
GIE_ENABLE();
}
static inline int arch_irqs_disabled_flags(unsigned long flags)
{
return !flags;
}
static inline int arch_irqs_disabled(void)
{
return arch_irqs_disabled_flags(arch_local_save_flags());
}