Added kvfree backport
authorVladimir Sokolovsky <vlad@mellanox.com>
Tue, 13 Jan 2015 13:03:00 +0000 (15:03 +0200)
committerVladimir Sokolovsky <vlad@mellanox.com>
Tue, 13 Jan 2015 13:37:17 +0000 (15:37 +0200)
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
compat/Makefile
compat/compat-3.15.c [new file with mode: 0644]
config/rdma.m4
include/linux/compat-3.15.h [new file with mode: 0644]

index b58baac..7e0ba4f 100644 (file)
@@ -53,6 +53,7 @@ compat-$(CONFIG_COMPAT_KERNEL_3_9) += compat-3.9.o
 compat-$(CONFIG_COMPAT_KERNEL_3_11) += compat-3.11.o
 compat-$(CONFIG_COMPAT_KERNEL_3_12) += compat-3.12.o
 compat-$(CONFIG_COMPAT_KERNEL_3_13) += compat-3.13.o
 compat-$(CONFIG_COMPAT_KERNEL_3_11) += compat-3.11.o
 compat-$(CONFIG_COMPAT_KERNEL_3_12) += compat-3.12.o
 compat-$(CONFIG_COMPAT_KERNEL_3_13) += compat-3.13.o
+compat-$(CONFIG_COMPAT_KERNEL_3_15) += compat-3.15.o
 compat-$(CONFIG_COMPAT_KERNEL_3_16) += compat-3.16.o
 compat-$(CONFIG_COMPAT_KERNEL_3_18) += compat-3.18.o
 
 compat-$(CONFIG_COMPAT_KERNEL_3_16) += compat-3.16.o
 compat-$(CONFIG_COMPAT_KERNEL_3_18) += compat-3.18.o
 
diff --git a/compat/compat-3.15.c b/compat/compat-3.15.c
new file mode 100644 (file)
index 0000000..a39c2a5
--- /dev/null
@@ -0,0 +1,12 @@
+#include <linux/export.h>
+#include <linux/vmalloc.h>
+
+#define kvfree LINUX_BACKPORT(kvfree)
+void kvfree(const void *addr)
+{
+       if (is_vmalloc_addr(addr))
+               vfree(addr);
+       else
+               kfree(addr);
+}
+EXPORT_SYMBOL(kvfree);
index 6aae3dc..b4c07fa 100644 (file)
@@ -675,21 +675,6 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
                AC_MSG_RESULT(no)
        ])
 
                AC_MSG_RESULT(no)
        ])
 
-       AC_MSG_CHECKING([if mm.h has kvfree])
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/mm.h>
-       ],[
-               kvfree(NULL);
-
-               return 0;
-       ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_KVFREE, 1,
-                         [kvfree is defined])
-       ],[
-               AC_MSG_RESULT(no)
-       ])
-
        AC_MSG_CHECKING([if netdevice.h has dev_consume_skb_any])
        LB_LINUX_TRY_COMPILE([
                #include <linux/netdevice.h>
        AC_MSG_CHECKING([if netdevice.h has dev_consume_skb_any])
        LB_LINUX_TRY_COMPILE([
                #include <linux/netdevice.h>
diff --git a/include/linux/compat-3.15.h b/include/linux/compat-3.15.h
new file mode 100644 (file)
index 0000000..bb7ec03
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef LINUX_3_15_COMPAT_H
+#define LINUX_3_15_COMPAT_H
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0))
+
+#define kvfree LINUX_BACKPORT(kvfree)
+extern void kvfree(const void *addr);
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) */
+
+#endif /* LINUX_3_15_COMPAT_H */