Browse Source

qcacmn: Add CONFIG_CNSS_OUT_OF_TREE flag for QDF prealloc

Use CONFIG_CNSS_OUT_OF_TREE to control if CNSS prealloc driver is
built from in-kernel-tree source or out-of-kernel-tree source since
the exposed header file will be in different paths. This is also for
backward compatibility. Use internal flag CNSS_MEM_PRE_ALLOC instead
of CONFIG_WCNSS_MEM_PRE_ALLOC which will not be defined from kernel
defconfig for out-of-kernel-tree CNSS prealloc driver. CNSS_MEM_PRE_
ALLOC will be defined in the driver Kbuild no matter where CONFIG_
WCNSS_MEM_PRE_ALLOC gets defined.

Change-Id: I6e35f3e859fb429584e83665fe0290ffeb314312
CRs-fixed: 3074638
Yue Ma 3 years ago
parent
commit
41ab344f9e
1 changed files with 8 additions and 3 deletions
  1. 8 3
      qdf/linux/src/qdf_mem.c

+ 8 - 3
qdf/linux/src/qdf_mem.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2014-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
@@ -35,9 +36,13 @@
 #include <linux/string.h>
 #include <qdf_list.h>
 
-#if IS_ENABLED(CONFIG_WCNSS_MEM_PRE_ALLOC)
+#ifdef CNSS_MEM_PRE_ALLOC
+#ifdef CONFIG_CNSS_OUT_OF_TREE
+#include "cnss_prealloc.h"
+#else
 #include <net/cnss_prealloc.h>
 #endif
+#endif
 
 #if defined(MEMORY_DEBUG) || defined(NBUF_MEMORY_DEBUG)
 static bool mem_debug_disabled;
@@ -1380,7 +1385,7 @@ void __qdf_mempool_free(qdf_device_t osdev, __qdf_mempool_t pool, void *buf)
 }
 qdf_export_symbol(__qdf_mempool_free);
 
-#if IS_ENABLED(CONFIG_WCNSS_MEM_PRE_ALLOC)
+#ifdef CNSS_MEM_PRE_ALLOC
 static bool qdf_might_be_prealloc(void *ptr)
 {
 	if (ksize(ptr) > WCNSS_PRE_ALLOC_GET_THRESHOLD)
@@ -1434,7 +1439,7 @@ static inline bool qdf_mem_prealloc_put(void *ptr)
 {
 	return false;
 }
-#endif /* CONFIG_WCNSS_MEM_PRE_ALLOC */
+#endif /* CNSS_MEM_PRE_ALLOC */
 
 /* External Function implementation */
 #ifdef MEMORY_DEBUG