Merge tag 'pm-fixes-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[linux/fpc-iii.git] / arch / s390 / include / asm / bug.h
blob429f43a8a8e81fbac2837179ec5cf54ab04a49ba
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_S390_BUG_H
3 #define _ASM_S390_BUG_H
5 #include <linux/kernel.h>
7 #ifdef CONFIG_BUG
9 #ifdef CONFIG_DEBUG_BUGVERBOSE
11 #define __EMIT_BUG(x) do { \
12 asm volatile( \
13 "0: j 0b+2\n" \
14 "1:\n" \
15 ".section .rodata.str,\"aMS\",@progbits,1\n" \
16 "2: .asciz \""__FILE__"\"\n" \
17 ".previous\n" \
18 ".section __bug_table,\"aw\"\n" \
19 "3: .long 1b-3b,2b-3b\n" \
20 " .short %0,%1\n" \
21 " .org 3b+%2\n" \
22 ".previous\n" \
23 : : "i" (__LINE__), \
24 "i" (x), \
25 "i" (sizeof(struct bug_entry))); \
26 } while (0)
28 #else /* CONFIG_DEBUG_BUGVERBOSE */
30 #define __EMIT_BUG(x) do { \
31 asm volatile( \
32 "0: j 0b+2\n" \
33 "1:\n" \
34 ".section __bug_table,\"aw\"\n" \
35 "2: .long 1b-2b\n" \
36 " .short %0\n" \
37 " .org 2b+%1\n" \
38 ".previous\n" \
39 : : "i" (x), \
40 "i" (sizeof(struct bug_entry))); \
41 } while (0)
43 #endif /* CONFIG_DEBUG_BUGVERBOSE */
45 #define BUG() do { \
46 __EMIT_BUG(0); \
47 unreachable(); \
48 } while (0)
50 #define __WARN_FLAGS(flags) do { \
51 __EMIT_BUG(BUGFLAG_WARNING|(flags)); \
52 } while (0)
54 #define WARN_ON(x) ({ \
55 int __ret_warn_on = !!(x); \
56 if (__builtin_constant_p(__ret_warn_on)) { \
57 if (__ret_warn_on) \
58 __WARN(); \
59 } else { \
60 if (unlikely(__ret_warn_on)) \
61 __WARN(); \
62 } \
63 unlikely(__ret_warn_on); \
66 #define HAVE_ARCH_BUG
67 #define HAVE_ARCH_WARN_ON
68 #endif /* CONFIG_BUG */
70 #include <asm-generic/bug.h>
72 #endif /* _ASM_S390_BUG_H */