diff mbox series

[U-Boot,v2,04/20] ARC: introduce is_isa_X functions

Message ID 20180321125905.14897-5-Eugeniy.Paltsev@synopsys.com
State Accepted, archived
Delegated to: Alexey Brodkin
Headers show
Series ARC: cache subsystem improvement/refactoring | expand

Commit Message

Eugeniy Paltsev March 21, 2018, 12:58 p.m. UTC
Introduce is_isa_arcv2 and is_isa_arcompact functions.
As this functions only check configuration options and return
compile-time constant they can be used instead of #ifdef's to
to write clear code.

So we can write
-------------->8---------------
if (is_isa_arcv2())
	ioc_configure();
-------------->8---------------
instead of
-------------->8---------------
ifdef CONFIG_ISA_ARCV2
	ioc_configure();
endif
-------------->8---------------

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
 arch/arc/include/asm/arcregs.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index 67f416305d..3a513149f5 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -8,6 +8,7 @@ 
 #define _ASM_ARC_ARCREGS_H
 
 #include <asm/cache.h>
+#include <config.h>
 
 /*
  * ARC architecture has additional address space - auxiliary registers.
@@ -88,6 +89,16 @@ 
 
 /* ARCNUM [15:8] - field to identify each core in a multi-core system */
 #define CPU_ID_GET()	((read_aux_reg(ARC_AUX_IDENTITY) & 0xFF00) >> 8)
+
+static const inline int is_isa_arcv2(void)
+{
+	return IS_ENABLED(CONFIG_ISA_ARCV2);
+}
+
+static const inline int is_isa_arcompact(void)
+{
+	return IS_ENABLED(CONFIG_ISA_ARCOMPACT);
+}
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_ARC_ARCREGS_H */