kernel/3.1[02]: move MTD root device setup code to mtdcore
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-3.10 / 504-yaffs-Mods-for-Linux-3.0-and-fix-a-typo.patch
1 From e1537a700c2e750c5eacc5ad93f30821f1e94424 Mon Sep 17 00:00:00 2001
2 From: Charles Manning <cdhmanning@gmail.com>
3 Date: Mon, 15 Aug 2011 11:40:30 +1200
4 Subject: [PATCH 2/2] Mods for Linux 3.0 and fix a typo
5
6 commit a7b5dcf904ba6f7890e4b77ce1f56388b855d0f6 upstream.
7
8 Roll in NCB's patch and some other changes for Linux 3.0.
9 Also fix a dumb type retired_writes->retried_writes
10
11 Signed-off-by: Charles Manning <cdhmanning@gmail.com>
12 ---
13 patch-ker.sh | 2 +-
14 yaffs_vfs_glue.c | 42 ++++++++++++++++++++++++++++++++++--------
15 2 files changed, 35 insertions(+), 9 deletions(-)
16
17 --- a/fs/yaffs2/yaffs_vfs_glue.c
18 +++ b/fs/yaffs2/yaffs_vfs_glue.c
19 @@ -72,7 +72,9 @@
20 #include <linux/init.h>
21 #include <linux/fs.h>
22 #include <linux/proc_fs.h>
23 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39))
24 #include <linux/smp_lock.h>
25 +#endif
26 #include <linux/pagemap.h>
27 #include <linux/mtd/mtd.h>
28 #include <linux/interrupt.h>
29 @@ -236,7 +238,9 @@ static int yaffs_file_flush(struct file
30 static int yaffs_file_flush(struct file *file);
31 #endif
32
33 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
34 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
35 +static int yaffs_sync_object(struct file *file, loff_t start, loff_t end, int datasync);
36 +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
37 static int yaffs_sync_object(struct file *file, int datasync);
38 #else
39 static int yaffs_sync_object(struct file *file, struct dentry *dentry,
40 @@ -1864,7 +1868,9 @@ static int yaffs_symlink(struct inode *d
41 return -ENOMEM;
42 }
43
44 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
45 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
46 +static int yaffs_sync_object(struct file *file, loff_t start, loff_t end, int datasync)
47 +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
48 static int yaffs_sync_object(struct file *file, int datasync)
49 #else
50 static int yaffs_sync_object(struct file *file, struct dentry *dentry,
51 @@ -3067,7 +3073,13 @@ static int yaffs_internal_read_super_mtd
52 return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL;
53 }
54
55 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
56 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
57 +static struct dentry *yaffs_mount(struct file_system_type *fs_type, int flags,
58 + const char *dev_name, void *data)
59 +{
60 + return mount_bdev(fs_type, flags, dev_name, data, yaffs_internal_read_super_mtd);
61 +}
62 +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
63 static int yaffs_read_super(struct file_system_type *fs,
64 int flags, const char *dev_name,
65 void *data, struct vfsmount *mnt)
66 @@ -3090,8 +3102,12 @@ static struct super_block *yaffs_read_su
67 static struct file_system_type yaffs_fs_type = {
68 .owner = THIS_MODULE,
69 .name = "yaffs",
70 - .get_sb = yaffs_read_super,
71 - .kill_sb = kill_block_super,
72 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
73 + .mount = yaffs_mount,
74 +#else
75 + .get_sb = yaffs_read_super,
76 +#endif
77 + .kill_sb = kill_block_super,
78 .fs_flags = FS_REQUIRES_DEV,
79 };
80 #else
81 @@ -3115,7 +3131,13 @@ static int yaffs2_internal_read_super_mt
82 return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL;
83 }
84
85 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
86 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
87 +static struct dentry *yaffs2_mount(struct file_system_type *fs_type, int flags,
88 + const char *dev_name, void *data)
89 +{
90 + return mount_bdev(fs_type, flags, dev_name, data, yaffs2_internal_read_super_mtd);
91 +}
92 +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
93 static int yaffs2_read_super(struct file_system_type *fs,
94 int flags, const char *dev_name, void *data,
95 struct vfsmount *mnt)
96 @@ -3137,8 +3159,12 @@ static struct super_block *yaffs2_read_s
97 static struct file_system_type yaffs2_fs_type = {
98 .owner = THIS_MODULE,
99 .name = "yaffs2",
100 - .get_sb = yaffs2_read_super,
101 - .kill_sb = kill_block_super,
102 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
103 + .mount = yaffs2_mount,
104 +#else
105 + .get_sb = yaffs2_read_super,
106 +#endif
107 + .kill_sb = kill_block_super,
108 .fs_flags = FS_REQUIRES_DEV,
109 };
110 #else