]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390/bug: Implement WARN_ONCE()
authorHeiko Carstens <hca@linux.ibm.com>
Fri, 9 Jan 2026 15:31:42 +0000 (16:31 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Tue, 27 Jan 2026 11:16:16 +0000 (12:16 +0100)
This is the s390 variant of commit 11bb4944f014 ("x86/bug: Implement
WARN_ONCE()").

Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/bug.h

index 1559873b19b0953a3e242fbcea30221be4b0a3e3..1fbcbdbc595fe1c977c488fcdfe77fa5db8ca56e 100644 (file)
@@ -104,6 +104,17 @@ do {                                                                       \
 #define __WARN_printf(taint, fmt, arg...) \
        __WARN_print_arg(BUGFLAG_TAINT(taint), fmt, ## arg)
 
+#define WARN_ONCE(cond, format, arg...)                                        \
+({                                                                     \
+       int __ret_warn_on = !!(cond);                                   \
+                                                                       \
+       if (unlikely(__ret_warn_on)) {                                  \
+               __WARN_print_arg(BUGFLAG_ONCE|BUGFLAG_TAINT(TAINT_WARN),\
+                               format, ## arg);                        \
+       }                                                               \
+       __ret_warn_on;                                                  \
+})
+
 #define HAVE_ARCH_BUG
 #define HAVE_ARCH_BUG_FORMAT
 #define HAVE_ARCH_BUG_FORMAT_ARGS