2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 04:34:11 +08:00

drm/amd/display: Clean up debug macros

This patch simplifies the ASSERT*() and BREAK_TO_DEBUGGER() macros:
- Move the dependency check of CONFIG_KGDB into Kconfig
- Unify the kgdb_breakpoint() call
- Drop the non-existing CONFIG_HAVE_KGDB

Also align the behavior of ASSERT() macro in both cases with and
without CONFIG_DEBUG_KERNEL_DC.

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Takashi Iwai 2020-10-23 09:46:56 +02:00 committed by Alex Deucher
parent 8b7dc1fe1a
commit bcc3775dcf
2 changed files with 13 additions and 21 deletions

View File

@ -42,6 +42,7 @@ config DRM_AMD_DC_SI
config DEBUG_KERNEL_DC config DEBUG_KERNEL_DC
bool "Enable kgdb break in DC" bool "Enable kgdb break in DC"
depends on DRM_AMD_DC depends on DRM_AMD_DC
depends on KGDB
help help
Choose this option if you want to hit kdgb_break in assert. Choose this option if you want to hit kdgb_break in assert.

View File

@ -94,36 +94,27 @@
* general debug capabilities * general debug capabilities
* *
*/ */
#if defined(CONFIG_DEBUG_KERNEL_DC) && (defined(CONFIG_HAVE_KGDB) || defined(CONFIG_KGDB)) #ifdef CONFIG_DEBUG_KERNEL_DC
#define ASSERT_CRITICAL(expr) do { \ #define dc_breakpoint() kgdb_breakpoint()
if (WARN_ON(!(expr))) { \
kgdb_breakpoint(); \
} \
} while (0)
#else #else
#define ASSERT_CRITICAL(expr) do { \ #define dc_breakpoint() do {} while (0)
if (WARN_ON(!(expr))) { \
; \
} \
} while (0)
#endif #endif
#if defined(CONFIG_DEBUG_KERNEL_DC) #define ASSERT_CRITICAL(expr) do { \
#define ASSERT(expr) ASSERT_CRITICAL(expr) if (WARN_ON(!(expr))) \
dc_breakpoint(); \
} while (0)
#else #define ASSERT(expr) do { \
#define ASSERT(expr) WARN_ON_ONCE(!(expr)) if (WARN_ON_ONCE(!(expr))) \
#endif dc_breakpoint(); \
} while (0)
#if defined(CONFIG_DEBUG_KERNEL_DC) && (defined(CONFIG_HAVE_KGDB) || defined(CONFIG_KGDB))
#define BREAK_TO_DEBUGGER() \ #define BREAK_TO_DEBUGGER() \
do { \ do { \
DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__); \ DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__); \
kgdb_breakpoint(); \ dc_breakpoint(); \
} while (0) } while (0)
#else
#define BREAK_TO_DEBUGGER() DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__)
#endif
#define DC_ERR(...) do { \ #define DC_ERR(...) do { \
dm_error(__VA_ARGS__); \ dm_error(__VA_ARGS__); \