drm/amd/display: Clean up debug macros
authorTakashi Iwai <tiwai@suse.de>
Fri, 23 Oct 2020 07:46:56 +0000 (09:46 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 26 Oct 2020 21:19:30 +0000 (17:19 -0400)
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>
drivers/gpu/drm/amd/display/Kconfig
drivers/gpu/drm/amd/display/dc/os_types.h

index f24abf4..60dfdd4 100644 (file)
@@ -42,6 +42,7 @@ config DRM_AMD_DC_SI
 config DEBUG_KERNEL_DC
        bool "Enable kgdb break in DC"
        depends on DRM_AMD_DC
+       depends on KGDB
        help
          Choose this option if you want to hit kdgb_break in assert.
 
index 32758b2..95cb569 100644 (file)
  * general debug capabilities
  *
  */
-#if defined(CONFIG_DEBUG_KERNEL_DC) && (defined(CONFIG_HAVE_KGDB) || defined(CONFIG_KGDB))
-#define ASSERT_CRITICAL(expr) do {     \
-       if (WARN_ON(!(expr))) { \
-               kgdb_breakpoint(); \
-       } \
-} while (0)
+#ifdef CONFIG_DEBUG_KERNEL_DC
+#define dc_breakpoint()                kgdb_breakpoint()
 #else
-#define ASSERT_CRITICAL(expr) do {     \
-       if (WARN_ON(!(expr))) { \
-               ; \
-       } \
-} while (0)
+#define dc_breakpoint()                do {} while (0)
 #endif
 
-#if defined(CONFIG_DEBUG_KERNEL_DC)
-#define ASSERT(expr) ASSERT_CRITICAL(expr)
+#define ASSERT_CRITICAL(expr) do {             \
+               if (WARN_ON(!(expr)))           \
+                       dc_breakpoint();        \
+       } while (0)
 
-#else
-#define ASSERT(expr) WARN_ON_ONCE(!(expr))
-#endif
+#define ASSERT(expr) do {                      \
+               if (WARN_ON_ONCE(!(expr)))      \
+                       dc_breakpoint();        \
+       } while (0)
 
-#if defined(CONFIG_DEBUG_KERNEL_DC) && (defined(CONFIG_HAVE_KGDB) || defined(CONFIG_KGDB))
 #define BREAK_TO_DEBUGGER() \
        do { \
                DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__); \
-               kgdb_breakpoint(); \
+               dc_breakpoint(); \
        } while (0)
-#else
-#define BREAK_TO_DEBUGGER() DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__)
-#endif
 
 #define DC_ERR(...)  do { \
        dm_error(__VA_ARGS__); \