diff options
| author | Peter Zijlstra <peterz@infradead.org> | 2025-06-02 15:08:30 +0200 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2025-11-24 20:23:25 +0100 |
| commit | 11bb4944f014d756f35261f5afcb346901ef1efa (patch) | |
| tree | 2c844bd303208a62f312694dd00dd68877a702a9 /arch/x86/include | |
| parent | 5b472b6e5bd951b208fbbe373892891398eb5ad1 (diff) | |
x86/bug: Implement WARN_ONCE()
Implement WARN_ONCE like WARN using BUGFLAG_ONCE.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251110115758.339309119@infradead.org
Diffstat (limited to 'arch/x86/include')
| -rw-r--r-- | arch/x86/include/asm/bug.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index b5474603460b..87199e6633f9 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -178,6 +178,15 @@ 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; \ +}) + #endif /* HAVE_ARCH_BUG_FORMAT_ARGS */ #include <asm-generic/bug.h> |
