compat: backport simple_open()
authorLuis R. Rodriguez <mcgrof@frijolero.org>
Mon, 2 Apr 2012 22:40:27 +0000 (15:40 -0700)
committerLuis R. Rodriguez <mcgrof@frijolero.org>
Mon, 2 Apr 2012 22:40:27 +0000 (15:40 -0700)
This is not yet upstream on Linus' tree so my best guess is
it will make it on the 3.5 release.

commit 90c936d19fb5cb3fb6b74dc18bf4bb3314a6a599
Author: Stephen Boyd <sboyd@codeaurora.org>
Date:   Wed Mar 21 10:48:20 2012 +1100

    libfs: add simple_open()

    debugfs and a few other drivers use an open-coded version of simple_open()
    to pass a pointer from the file to the read/write file ops.  Add support
    for this simple case to libfs so that we can remove the many duplicate
    copies of this simple function.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mcgrof@tux ~/compat (git::master)$ ckmake
Trying kernel                  3.3.0-030300rc2-generic [OK]
Trying kernel                     3.2.2-030202-generic [OK]
Trying kernel                    3.1.10-030110-generic [OK]
Trying kernel                    3.0.18-030018-generic [OK]
Trying kernel                  2.6.39-02063904-generic [OK]
Trying kernel                  2.6.38-02063808-generic [OK]
Trying kernel                  2.6.37-02063706-generic [OK]
Trying kernel                  2.6.36-02063604-generic [OK]
Trying kernel                  2.6.35-02063512-generic [OK]
Trying kernel                  2.6.34-02063410-generic [OK]
Trying kernel                  2.6.33-02063305-generic [OK]
Trying kernel                  2.6.32-02063255-generic [OK]
Trying kernel                  2.6.31-02063113-generic [OK]
Trying kernel                  2.6.30-02063010-generic [OK]
Trying kernel                  2.6.29-02062906-generic [OK]
Trying kernel                  2.6.28-02062810-generic [OK]
Trying kernel                    2.6.27-020627-generic [OK]
Trying kernel                    2.6.26-020626-generic [OK]
Trying kernel                    2.6.25-020625-generic [OK]
Trying kernel                    2.6.24-020624-generic [OK]

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
compat/Makefile
compat/compat-3.5.c [new file with mode: 0644]
include/linux/compat-3.5.h [new file with mode: 0644]
scripts/gen-compat-config.sh

index b49e8c0..f2beca8 100644 (file)
@@ -36,6 +36,7 @@ compat-$(CONFIG_COMPAT_KERNEL_2_6_39) += \
 compat-$(CONFIG_COMPAT_KERNEL_3_0) += compat-3.0.o
 compat-$(CONFIG_COMPAT_KERNEL_3_2) += compat-3.2.o
 compat-$(CONFIG_COMPAT_KERNEL_3_3) += compat-3.3.o
+compat-$(CONFIG_COMPAT_KERNEL_3_5) += compat-3.5.o
 
 compat-$(CONFIG_COMPAT_CORDIC) += cordic.o
 compat-$(CONFIG_COMPAT_CRC8) += crc8.o
diff --git a/compat/compat-3.5.c b/compat/compat-3.5.c
new file mode 100644 (file)
index 0000000..d29c5f9
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2012  Luis R. Rodriguez <mcgrof@frijolero.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Compatibility file for Linux wireless for kernels 3.5.
+ */
+
+#include <linux/fs.h>
+
+int simple_open(struct inode *inode, struct file *file)
+{
+       if (inode->i_private)
+               file->private_data = inode->i_private;
+       return 0;
+}
+EXPORT_SYMBOL_GPL(simple_open);
diff --git a/include/linux/compat-3.5.h b/include/linux/compat-3.5.h
new file mode 100644 (file)
index 0000000..9c10a42
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef LINUX_3_5_COMPAT_H
+#define LINUX_3_5_COMPAT_H
+
+#include <linux/version.h>
+#include <linux/fs.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
+
+extern int simple_open(struct inode *inode, struct file *file);
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) */
+
+#endif /* LINUX_3_5_COMPAT_H */
index 6cdac12..f56cbfc 100755 (executable)
@@ -17,7 +17,7 @@ fi
 KERNEL_VERSION=$(${MAKE} -C ${KLIB_BUILD} kernelversion | sed -n 's/^\([0-9]\)\..*/\1/p')
 
 # 3.0 kernel stuff
-COMPAT_LATEST_VERSION="3"
+COMPAT_LATEST_VERSION="5"
 KERNEL_SUBLEVEL="-1"
 
 # Note that this script will export all variables explicitly,