MT6620: add the new driver JB2 V1.0
[firefly-linux-kernel-4.4.55.git] / drivers / mtk_wcn_combo / drv_fm / inc / fm_stdlib.h
1 #ifndef __FM_STDLIB_H__
2 #define __FM_STDLIB_H__
3
4 #include "fm_typedef.h"
5 #include <linux/string.h>
6
7 #if 1
8 #define fm_memset(buf, a, len)  \
9 ({                                    \
10     void *__ret = (void*)0;              \
11     __ret = memset((buf), (a), (len)); \
12     __ret;                          \
13 })
14
15 #define fm_memcpy(dst, src, len)  \
16 ({                                    \
17     void *__ret = (void*)0;              \
18     __ret = memcpy((dst), (src), (len)); \
19     __ret;                          \
20 })
21
22 #define fm_malloc(len)  \
23 ({                                    \
24     void *__ret = (void*)0;              \
25     __ret = kmalloc(len, GFP_KERNEL); \
26     __ret;                          \
27 })
28
29 #define fm_zalloc(len)  \
30 ({                                    \
31     void *__ret = (void*)0;              \
32     __ret = kzalloc(len, GFP_KERNEL); \
33     __ret;                          \
34 })
35
36 #define fm_free(ptr)  kfree(ptr)
37
38 #define fm_vmalloc(len)  \
39 ({                                    \
40     void *__ret = (void*)0;              \
41     __ret = vmalloc(len); \
42     __ret;                          \
43 })
44
45 #define fm_vfree(ptr)  vfree(ptr)
46
47 #else
48 inline void* fm_memset(void *buf, fm_s8 val, fm_s32 len)
49 {
50     return memset(buf, val, len);
51 }
52
53 inline void* fm_memcpy(void *dst, const void *src, fm_s32 len)
54 {
55     return memcpy(dst, src, len);
56 }
57
58 #endif
59
60 #endif //__FM_STDLIB_H__
61