s390/kernel: unify EX_TABLE* implementations
authorIlya Leoshkevich <iii@linux.ibm.com>
Mon, 29 Jun 2020 18:48:09 +0000 (20:48 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 20 Jul 2020 08:55:45 +0000 (10:55 +0200)
Replace three implementations with one using using __stringify_in_c
macro conveniently "borrowed" from powerpc and microblaze.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/asm-const.h [new file with mode: 0644]
arch/s390/include/asm/linkage.h

diff --git a/arch/s390/include/asm/asm-const.h b/arch/s390/include/asm/asm-const.h
new file mode 100644 (file)
index 0000000..11f615e
--- /dev/null
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_S390_ASM_CONST_H
+#define _ASM_S390_ASM_CONST_H
+
+#ifdef __ASSEMBLY__
+#  define stringify_in_c(...)  __VA_ARGS__
+#else
+/* This version of stringify will deal with commas... */
+#  define __stringify_in_c(...)        #__VA_ARGS__
+#  define stringify_in_c(...)  __stringify_in_c(__VA_ARGS__) " "
+#endif
+#endif /* _ASM_S390_ASM_CONST_H */
index 7f22262..1b52c07 100644 (file)
@@ -2,38 +2,26 @@
 #ifndef __ASM_LINKAGE_H
 #define __ASM_LINKAGE_H
 
+#include <asm/asm-const.h>
 #include <linux/stringify.h>
 
 #define __ALIGN .align 4, 0x07
 #define __ALIGN_STR __stringify(__ALIGN)
 
-#ifndef __ASSEMBLY__
-
 /*
  * Helper macro for exception table entries
  */
-#define EX_TABLE(_fault, _target)      \
-       ".section __ex_table,\"a\"\n"   \
-       ".align 4\n"                    \
-       ".long  (" #_fault ") - .\n"    \
-       ".long  (" #_target ") - .\n"   \
-       ".previous\n"
-
-#else /* __ASSEMBLY__ */
 
-#define EX_TABLE(_fault, _target)      \
-       .section __ex_table,"a" ;       \
-       .align  4 ;                     \
-       .long   (_fault) - . ;          \
-       .long   (_target) - . ;         \
-       .previous
+#define __EX_TABLE(_section, _fault, _target)                          \
+       stringify_in_c(.section _section,"a";)                          \
+       stringify_in_c(.align   4;)                                     \
+       stringify_in_c(.long    (_fault) - .;)                          \
+       stringify_in_c(.long    (_target) - .;)                         \
+       stringify_in_c(.previous)
 
-#define EX_TABLE_DMA(_fault, _target)  \
-       .section .dma.ex_table, "a" ;   \
-       .align  4 ;                     \
-       .long   (_fault) - . ;          \
-       .long   (_target) - . ;         \
-       .previous
+#define EX_TABLE(_fault, _target)                                      \
+       __EX_TABLE(__ex_table, _fault, _target)
+#define EX_TABLE_DMA(_fault, _target)                                  \
+       __EX_TABLE(.dma.ex_table, _fault, _target)
 
-#endif /* __ASSEMBLY__ */
 #endif