Переглянути джерело

qcacmn: Fix compliation error when disable CONFIG_LEAK_DETECTION

Fix error when disable CONFIG_LEAK_DETECTION.

Change-Id: I16d85b596ef64ad45e9fb0bb594b0a3287554e8f
CRs-Fixed: 3080460
Jingxiang Ge 3 роки тому
батько
коміт
2ed71bd979

+ 39 - 0
qdf/inc/qdf_tracker.h

@@ -1,5 +1,7 @@
 /*
  * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -60,6 +62,7 @@ struct qdf_tracker name = { \
 	.ht = qdf_ptr_hash_ptr(name ## _ht), \
 }
 
+#ifdef CONFIG_LEAK_DETECTION
 /**
  * qdf_tracker_init() - initialize a qdf_tracker
  * @tracker: the qdf_tracker to initialize
@@ -125,6 +128,42 @@ qdf_must_check bool
 qdf_tracker_lookup(struct qdf_tracker *tracker, void *ptr,
 		   char (*out_func)[QDF_TRACKER_FUNC_SIZE],
 		   uint32_t *out_line);
+#else
+static inline
+void qdf_tracker_init(struct qdf_tracker *tracker)
+{
+}
+
+static inline
+void qdf_tracker_deinit(struct qdf_tracker *tracker)
+{
+}
 
+static inline qdf_must_check QDF_STATUS
+qdf_tracker_track(struct qdf_tracker *tracker, void *ptr,
+		  const char *func, uint32_t line)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+void qdf_tracker_untrack(struct qdf_tracker *tracker, void *ptr,
+			 const char *func, uint32_t line)
+{
+}
+
+static inline
+void qdf_tracker_check_for_leaks(struct qdf_tracker *tracker)
+{
+}
+
+static inline qdf_must_check bool
+qdf_tracker_lookup(struct qdf_tracker *tracker, void *ptr,
+		   char (*out_func)[QDF_TRACKER_FUNC_SIZE],
+		   uint32_t *out_line)
+{
+	return false;
+}
+#endif
 #endif /* __QDF_TRACKER_H */
 

+ 3 - 1
qdf/src/qdf_tracker.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2019, 2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -26,6 +27,7 @@
 #include "qdf_tracker.h"
 #include "qdf_types.h"
 
+#ifdef CONFIG_LEAK_DETECTION
 struct qdf_tracker_node {
 	struct qdf_ptr_hash_entry entry;
 	enum qdf_debug_domain domain;
@@ -186,4 +188,4 @@ bool qdf_tracker_lookup(struct qdf_tracker *tracker, void *ptr,
 
 	return !!node;
 }
-
+#endif

+ 4 - 1
qdf/test/qdf_tracker_test.c

@@ -1,5 +1,7 @@
 /*
  * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -21,6 +23,7 @@
 #include "qdf_trace.h"
 #include "qdf_types.h"
 
+#if defined(CONFIG_LEAK_DETECTION) && defined(WLAN_TRACKER_TEST)
 #define qdf_ut_tracker_bits 4 /* 16 buckets */
 #define qdf_ut_tracker_item_count 3
 #define qdf_ut_tracker_declare(name) \
@@ -92,4 +95,4 @@ uint32_t qdf_tracker_unit_test(void)
 
 	return errors;
 }
-
+#endif

+ 3 - 1
qdf/test/qdf_tracker_test.h

@@ -1,5 +1,7 @@
 /*
  * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -19,7 +21,7 @@
 #ifndef __QDF_TRACKER_TEST
 #define __QDF_TRACKER_TEST
 
-#ifdef WLAN_TRACKER_TEST
+#if defined(CONFIG_LEAK_DETECTION) && defined(WLAN_TRACKER_TEST)
 /**
  * qdf_tracker_unit_test() - run the qdf tracker unit test suite
  *