V4L/DVB (13021): go7007: Fix whitespace and line lengths
[firefly-linux-kernel-4.4.55.git] / drivers / staging / otus / wrap_mem.c
1 /*
2  * Copyright (c) 2007-2008 Atheros Communications Inc.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 /*  Module Name : wrap_mem.c                                            */
17 /*                                                                      */
18 /*  Abstract                                                            */
19 /*     This module contains wrapper functions for memory management     */
20 /*                                                                      */
21 /*  NOTES                                                               */
22 /*     Platform dependent.                                              */
23 /*                                                                      */
24 /************************************************************************/
25
26 #include "oal_dt.h"
27 #include "usbdrv.h"
28
29 #include <linux/netlink.h>
30 #include <net/iw_handler.h>
31
32 /* Memory management */
33 /* Called to allocate uncached memory, allocated memory must    */
34 /* in 4-byte boundary                                           */
35 void* zfwMemAllocate(zdev_t* dev, u32_t size)
36 {
37     void* mem = NULL;
38     mem = kmalloc(size, GFP_ATOMIC);
39     return mem;
40 }
41
42
43 /* Called to free allocated memory */
44 void zfwMemFree(zdev_t* dev, void* mem, u32_t size)
45 {
46     kfree(mem);
47     return;
48 }
49
50 void zfwMemoryCopy(u8_t* dst, u8_t* src, u16_t length)
51 {
52     //u16_t i;
53
54     memcpy(dst, src, length);
55     //for(i=0; i<length; i++)
56     //{
57     //    dst[i] = src[i];
58     //}
59     return;
60 }
61
62 void zfwZeroMemory(u8_t* va, u16_t length)
63 {
64     //u16_t i;
65     memset(va, 0, length);
66     //for(i=0; i<length; i++)
67     //{
68     //    va[i] = 0;
69     //}
70     return;
71 }
72
73 void zfwMemoryMove(u8_t* dst, u8_t* src, u16_t length)
74 {
75     memcpy(dst, src, length);
76     return;
77 }
78
79 u8_t zfwMemoryIsEqual(u8_t* m1, u8_t* m2, u16_t length)
80 {
81     //u16_t i;
82     int ret;
83
84     ret = memcmp(m1, m2, length);
85
86     return ((ret==0)?TRUE:FALSE);
87     //for(i=0; i<length; i++)
88     //{
89     //    if ( m1[i] != m2[i] )
90     //    {
91     //        return FALSE;
92     //    }
93     //}
94
95     //return TRUE;
96 }
97
98 /* Leave an empty line below to remove warning message on some compiler */