瀏覽代碼

qcacmn: Add support to invoke debug function before assert

qdf assert always, assert without debug information.
Added support to dump needed information before assert.

Change-Id: I19898ec11c1bade4340cf1737a760d9507012f12
CRs-Fixed: 3480596
nobelj 2 年之前
父節點
當前提交
fffa314bff
共有 2 個文件被更改,包括 20 次插入0 次删除
  1. 8 0
      qdf/inc/qdf_util.h
  2. 12 0
      qdf/linux/src/i_qdf_util.h

+ 8 - 0
qdf/inc/qdf_util.h

@@ -91,6 +91,14 @@ typedef __qdf_wait_queue_head_t qdf_wait_queue_head_t;
  */
 #define qdf_assert_always(expr)  __qdf_assert(expr)
 
+/**
+ * qdf_assert_with_debug - invoke function to dump needed info before assert
+ * @expr: expression to test
+ * @debug_fp: function pointer to be invoked for debugging
+ */
+#define qdf_assert_with_debug(expr, debug_fp, ...) \
+	__qdf_assert_with_debug(expr, debug_fp, ...)
+
 /**
  * qdf_target_assert_always - always target assert "expr" evaluates to false.
  * @expr: expression to test

+ 12 - 0
qdf/linux/src/i_qdf_util.h

@@ -212,6 +212,18 @@ static inline bool __qdf_is_macaddr_equal(const struct qdf_mac_addr *mac_addr1,
 		} \
 } while (0)
 
+#define __qdf_assert_with_debug(expr, debug_fp, ...)			\
+	do {								\
+		typeof(debug_fp) _debug_fp = debug_fp;			\
+		if (unlikely(!(expr))) {				\
+			pr_err("Assertion failed! %s:%s %s:%d\n",	\
+			       # expr, __func__, __FILE__, __LINE__);	\
+			if (_debug_fp)					\
+				_debug_fp(__VA_ARGS__);			\
+			QDF_BUG_ON_ASSERT(0);				\
+		}							\
+	} while (0)
+
 #define __qdf_target_assert(expr)  do {    \
 	if (unlikely(!(expr))) {                                 \
 		qdf_err("Assertion failed! %s:%s %s:%d",   \