mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein@systec-electronic.com>
To: barebox@lists.infradead.org
Cc: Daniel Krueger <daniel.krueger@systec-electronic.com>,
	Alexander Stein <alexander.stein@systec-electronic.com>
Subject: [PATCH 11/13] barebox-wrapper: Implement kfree and vfree as static inline functions
Date: Thu, 17 Mar 2016 11:00:27 +0100	[thread overview]
Message-ID: <1458208829-25570-12-git-send-email-alexander.stein@systec-electronic.com> (raw)
In-Reply-To: <1458208829-25570-1-git-send-email-alexander.stein@systec-electronic.com>

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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2016-03-17 10:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-17 10:00 [PATCH 00/13] ubifs update Alexander Stein
2016-03-17 10:00 ` [PATCH 01/13] mtd: cfi-flash: Set MTD's writebufsize Alexander Stein
2016-03-17 10:00 ` [PATCH 02/13] mtd: ubi: Set max_write_size to actual value read from flash Alexander Stein
2016-03-17 10:00 ` [PATCH 03/13] rbtree: Update to u-boot v2016.03 Alexander Stein
2016-03-17 10:00 ` [PATCH 04/13] printk: Add printk_once Alexander Stein
2016-03-17 10:00 ` [PATCH 05/13] Add list_sort from u-boot v2016.03 Alexander Stein
2016-03-17 10:00 ` [PATCH 06/13] printk: Add pr_cont Alexander Stein
2016-03-17 10:00 ` [PATCH 07/13] compiler*.h: include/linux/compiler*.h with Linux 4.5 Alexander Stein
2016-03-17 10:00 ` [PATCH 08/13] module.h: Add THIS_MODULE Alexander Stein
2016-03-17 10:00 ` [PATCH 09/13] ARM: Add atomic.h from u-boot v2016.03 Alexander Stein
2016-03-17 10:00 ` [PATCH 10/13] Move GFP_NOFS to barebox-wrapper Alexander Stein
2016-03-17 10:00 ` Alexander Stein [this message]
2016-03-30  6:19   ` [PATCH 11/13] barebox-wrapper: Implement kfree and vfree as static inline functions Sascha Hauer
2016-03-17 10:00 ` [PATCH 12/13] barebox-wrapper: Add kcalloc and __vmalloc Alexander Stein
2016-03-17 10:00 ` [PATCH 13/13] ubifs: update implementation from u-boot v2016.03 Alexander Stein
2016-07-19 11:41   ` Renaud Barbier
2016-07-21  6:30     ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458208829-25570-12-git-send-email-alexander.stein@systec-electronic.com \
    --to=alexander.stein@systec-electronic.com \
    --cc=barebox@lists.infradead.org \
    --cc=daniel.krueger@systec-electronic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox