[Intel-xe] [PATCH v2 3/3] drm/xe/macro: Display XE_WARN_ON messages only in debug mode
Francois Dugast
francois.dugast at intel.com
Thu Jul 27 13:26:30 UTC 2023
Make printing of XE_WARN_ON messages depend on Xe debug flag
CONFIG_DRM_XE_DEBUG, so that those messages are not printed in production
environments.
Signed-off-by: Francois Dugast <francois.dugast at intel.com>
---
drivers/gpu/drm/xe/xe_macros.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_macros.h b/drivers/gpu/drm/xe/xe_macros.h
index daf56c846d03..6ce86cf9605c 100644
--- a/drivers/gpu/drm/xe/xe_macros.h
+++ b/drivers/gpu/drm/xe/xe_macros.h
@@ -8,7 +8,14 @@
#include <linux/bug.h>
+#if IS_ENABLED(CONFIG_DRM_XE_DEBUG)
#define XE_WARN_ON WARN_ON
+#else
+#define XE_WARN_ON(condition) ({ \
+ int __ret_warn_on = !!(condition); \
+ unlikely(__ret_warn_on); \
+})
+#endif
#define XE_IOCTL_DBG(xe, cond) \
((cond) && (drm_dbg(&(xe)->drm, \
--
2.34.1
More information about the Intel-xe
mailing list