Explorar o código

qcacmn: Add QDF_DEBUG_PANIC API

A very common pattern in the Wlan driver is to test for a fatal
condition, and then call QDF_BUG with some falsy value. Add a sugar
API for these cases, which effectively does 'QDF_BUG(false)'.
Additionally, include 'debug' in the name to remind consumers that
the panic will not occur on end user devices.

Current syntax:

	if (fatal_condition)
		QDF_BUG(false);

New syntax:

	if (fatal_condition)
		QDF_DEBUG_PANIC();

Change-Id: Ifa03e9109be5efdbd061ca32363d5719fb91da0f
CRs-Fixed: 2191582
Dustin Brown %!s(int64=7) %!d(string=hai) anos
pai
achega
47452e942b
Modificáronse 2 ficheiros con 8 adicións e 5 borrados
  1. 6 3
      qdf/linux/src/i_qdf_trace.h
  2. 2 2
      qdf/linux/src/qdf_mc_timer.c

+ 6 - 3
qdf/linux/src/i_qdf_trace.h

@@ -117,9 +117,12 @@ static inline void qdf_trace_msg(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
 #endif
 
 #ifdef PANIC_ON_BUG
-#define __qdf_do_bug() BUG_ON(1)
+static inline void QDF_DEBUG_PANIC(void)
+{
+	BUG();
+}
 #else
-#define __qdf_do_bug()
+static inline void QDF_DEBUG_PANIC(void) { }
 #endif
 
 #define QDF_BUG(_condition) \
@@ -127,7 +130,7 @@ static inline void qdf_trace_msg(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
 		if (!(_condition)) { \
 			pr_err("QDF BUG in %s Line %d: Failed assertion '" \
 			       #_condition "'\n", __func__, __LINE__); \
-			__qdf_do_bug();\
+			QDF_DEBUG_PANIC(); \
 		} \
 	} while (0)
 

+ 2 - 2
qdf/linux/src/qdf_mc_timer.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -174,7 +174,7 @@ EXPORT_SYMBOL(qdf_mc_timer_manager_init);
 
 static inline void qdf_mc_timer_panic(void)
 {
-	QDF_BUG(0);
+	QDF_DEBUG_PANIC();
 }
 
 static void qdf_mc_timer_print_list(qdf_list_t *timers)