[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250106090335.5751-1-yangtiezhu@loongson.cn>
Date: Mon, 6 Jan 2025 17:03:35 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
Xinhui Pan <Xinhui.Pan@....com>,
Harry Wentland <harry.wentland@....com>,
Leo Li <sunpeng.li@....com>,
Rodrigo Siqueira <Rodrigo.Siqueira@....com>
Cc: Nathan Chancellor <nathan@...nel.org>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
loongarch@...ts.linux.dev,
amd-gfx@...ts.freedesktop.org,
llvm@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 4/5] drm/amd/display: Add SPL_ASSERT_BUG() macro definition
In order to keep the current ability for the aim of debugging and avoid
printing the warning message twice, add SPL_ASSERT_BUG() macro definition
to harden the callers of division functions.
Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
---
drivers/gpu/drm/amd/display/dc/spl/spl_debug.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/dc/spl/spl_debug.h b/drivers/gpu/drm/amd/display/dc/spl/spl_debug.h
index f01c932d550d..8220c5800692 100644
--- a/drivers/gpu/drm/amd/display/dc/spl/spl_debug.h
+++ b/drivers/gpu/drm/amd/display/dc/spl/spl_debug.h
@@ -11,18 +11,27 @@
kgdb_breakpoint(); \
} \
} while (0)
+#define SPL_ASSERT_EMERGENCY(expr) do { \
+ kgdb_breakpoint(); \
+ BUG_ON(!(expr)); \
+} while (0)
#else
#define SPL_ASSERT_CRITICAL(expr) do { \
if (WARN_ON(!(expr))) { \
; \
} \
} while (0)
+#define SPL_ASSERT_EMERGENCY(expr) do { \
+ BUG_ON(!(expr)); \
+} while (0)
#endif /* CONFIG_HAVE_KGDB || CONFIG_KGDB */
#if defined(CONFIG_DEBUG_KERNEL_DC)
#define SPL_ASSERT_WARN(expr) SPL_ASSERT_CRITICAL(expr)
+#define SPL_ASSERT_BUG(expr) SPL_ASSERT_EMERGENCY(expr)
#else
#define SPL_ASSERT_WARN(expr) WARN_ON(!(expr))
+#define SPL_ASSERT_BUG(expr) BUG_ON(!(expr))
#endif /* CONFIG_DEBUG_KERNEL_DC */
#define SPL_BREAK_TO_DEBUGGER() SPL_ASSERT_WARN(0)
--
2.42.0
Powered by blists - more mailing lists