[PATCH 11/13] barebox-wrapper: Implement kfree and vfree as static inline functions
Alexander Stein
alexander.stein at systec-electronic.com
Thu Mar 17 03:00:27 PDT 2016
If kfree/vfree is called where free is a already variable name, code will
not compile.
Also both take a const* in Linux kernel code.
Signed-off-by: Alexander Stein <alexander.stein at systec-electronic.com>
---
include/linux/barebox-wrapper.h | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/linux/barebox-wrapper.h b/include/linux/barebox-wrapper.h
index fc1b5c2..67b332e 100644
--- a/include/linux/barebox-wrapper.h
+++ b/include/linux/barebox-wrapper.h
@@ -1,14 +1,21 @@
#ifndef __INCLUDE_LINUX_BAREBOX_WRAPPER_H
#define __INCLUDE_LINUX_BAREBOX_WRAPPER_H
+#include <malloc.h>
#include <xfuncs.h>
#define kmalloc(len, mode) malloc(len)
#define kzalloc(len, mode) xzalloc(len)
#define vmalloc(len) malloc(len)
-#define kfree(ptr) free(ptr)
+static inline void kfree(const void *block)
+{
+ free((void *)block);
+}
#define vzalloc(len) kzalloc(len, 0)
-#define vfree(ptr) free(ptr)
+static inline void vfree(const void *addr)
+{
+ free((void *)addr);
+}
#define KERN_EMERG "" /* system is unusable */
#define KERN_ALERT "" /* action must be taken immediately */
--
2.7.3
More information about the barebox
mailing list