summaryrefslogtreecommitdiff
path: root/drivers/staging/csr/csr_pmem.c
blob: a07c44999168673870912115884f3d3fda11fece (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*****************************************************************************

            (c) Cambridge Silicon Radio Limited 2010
            All rights reserved and confidential information of CSR

            Refer to LICENSE.txt included with this source for details
            on the license terms.

*****************************************************************************/

#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/module.h>


#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
#include <linux/autoconf.h>
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
#include <linux/config.h>
#endif

#include <linux/slab.h>

#include "csr_panic.h"
#include "csr_pmem.h"

void *CsrPmemAlloc(CsrSize size)
{
    void *ret;

    ret = kmalloc(size, GFP_KERNEL);
    if (!ret)
    {
        CsrPanic(CSR_TECH_FW, CSR_PANIC_FW_HEAP_EXHAUSTION,
            "out of memory");
    }

    return ret;
}
EXPORT_SYMBOL_GPL(CsrPmemAlloc);

void CsrPmemFree(void *ptr)
{
    if (ptr == NULL)
    {
        return;
    }

    kfree(ptr);
}
EXPORT_SYMBOL_GPL(CsrPmemFree);