summaryrefslogtreecommitdiff
path: root/qdf/linux/src
diff options
context:
space:
mode:
authorDustin Brown <dustinb@codeaurora.org>2017-03-09 12:36:42 -0800
committerqcabuildsw <qcabuildsw@localhost>2017-03-10 01:09:01 -0800
commit54fcb21b4d9a0144639b5ee82546b8223daa3210 (patch)
tree3936451791f2230967a67a00ade0d812735ddde9 /qdf/linux/src
parenta7f1a62d2b595ec9dd0f9ace8c69ba65d9e5371c (diff)
qcacmn: Fix preallocation perf build compilation error
A compilation error occurs if MEMORY_DEBUG is not enabled. Fix this issue by moving the definition of qdf_mem_prealloc_put and qdf_mem_prealloc_get outside of the MEMORY_DEBUG region. Change-Id: I17b4ae2cd65658e961bf7aa37518635bb94b5a95 CRs-Fixed: 2017447
Diffstat (limited to 'qdf/linux/src')
-rw-r--r--qdf/linux/src/qdf_mem.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/qdf/linux/src/qdf_mem.c b/qdf/linux/src/qdf_mem.c
index 616f8c793771..fc4db07b0177 100644
--- a/qdf/linux/src/qdf_mem.c
+++ b/qdf/linux/src/qdf_mem.c
@@ -722,6 +722,47 @@ qdf_mem_zero_outline(void *buf, qdf_size_t size)
}
EXPORT_SYMBOL(qdf_mem_zero_outline);
+#ifdef CONFIG_WCNSS_MEM_PRE_ALLOC
+/**
+ * qdf_mem_prealloc_get() - conditionally pre-allocate memory
+ * @size: the number of bytes to allocate
+ *
+ * If size if greater than WCNSS_PRE_ALLOC_GET_THRESHOLD, this function returns
+ * a chunk of pre-allocated memory. If size if less than or equal to
+ * WCNSS_PRE_ALLOC_GET_THRESHOLD, or an error occurs, NULL is returned instead.
+ *
+ * Return: NULL on failure, non-NULL on success
+ */
+static void *qdf_mem_prealloc_get(size_t size)
+{
+ void *mem;
+
+ if (size <= WCNSS_PRE_ALLOC_GET_THRESHOLD)
+ return NULL;
+
+ mem = wcnss_prealloc_get(size);
+ if (mem)
+ memset(mem, 0, size);
+
+ return mem;
+}
+
+static inline bool qdf_mem_prealloc_put(void *ptr)
+{
+ return wcnss_prealloc_put(ptr);
+}
+#else
+static inline void *qdf_mem_prealloc_get(size_t size)
+{
+ return NULL;
+}
+
+static inline bool qdf_mem_prealloc_put(void *ptr)
+{
+ return false;
+}
+#endif /* CONFIG_WCNSS_MEM_PRE_ALLOC */
+
/* External Function implementation */
#ifdef MEMORY_DEBUG
@@ -826,47 +867,6 @@ void qdf_mem_exit(void)
}
EXPORT_SYMBOL(qdf_mem_exit);
-#ifdef CONFIG_WCNSS_MEM_PRE_ALLOC
-/**
- * qdf_mem_prealloc_get() - conditionally pre-allocate memory
- * @size: the number of bytes to allocate
- *
- * If size if greater than WCNSS_PRE_ALLOC_GET_THRESHOLD, this function returns
- * a chunk of pre-allocated memory. If size if less than or equal to
- * WCNSS_PRE_ALLOC_GET_THRESHOLD, or an error occurs, NULL is returned instead.
- *
- * Return: NULL on failure, non-NULL on success
- */
-static void *qdf_mem_prealloc_get(size_t size)
-{
- void *mem;
-
- if (size <= WCNSS_PRE_ALLOC_GET_THRESHOLD)
- return NULL;
-
- mem = wcnss_prealloc_get(size);
- if (mem)
- memset(mem, 0, size);
-
- return mem;
-}
-
-static inline bool qdf_mem_prealloc_put(void *ptr)
-{
- return wcnss_prealloc_put(ptr);
-}
-#else
-static inline void *qdf_mem_prealloc_get(size_t size)
-{
- return NULL;
-}
-
-static inline bool qdf_mem_prealloc_put(void *ptr)
-{
- return false;
-}
-#endif /* CONFIG_WCNSS_MEM_PRE_ALLOC */
-
/**
* qdf_mem_malloc_debug() - debug version of QDF memory allocation API
* @size: Number of bytes of memory to allocate.