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
This commit is contained in:
Dustin Brown 2017-03-09 12:36:42 -08:00 • committed by Sandeep Puligilla
commit e59d03a76b

View file

@ -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.