1 --- a/fs/yaffs2/yaffs_mtdif1.c
2 +++ b/fs/yaffs2/yaffs_mtdif1.c
3 @@ -133,7 +133,7 @@ int nandmtd1_WriteChunkWithTagsToNAND(ya
4 ops.datbuf = (__u8 *)data;
5 ops.oobbuf = (__u8 *)&pt1;
7 - retval = mtd->write_oob(mtd, addr, &ops);
8 + retval = mtd_write_oob(mtd, addr, &ops);
11 (TSTR("write_oob failed, chunk %d, mtd error %d"TENDSTR),
12 @@ -194,7 +194,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
13 /* Read page and oob using MTD.
14 * Check status and determine ECC result.
16 - retval = mtd->read_oob(mtd, addr, &ops);
17 + retval = mtd_read_oob(mtd, addr, &ops);
20 (TSTR("read_oob failed, chunk %d, mtd error %d"TENDSTR),
21 @@ -218,7 +218,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
24 rettags(etags, YAFFS_ECC_RESULT_UNFIXED, 0);
25 - etags->block_bad = (mtd->block_isbad)(mtd, addr);
26 + etags->block_bad = mtd_block_isbad(mtd, addr);
30 @@ -286,7 +286,7 @@ int nandmtd1_MarkNANDBlockBad(struct yaf
32 T(YAFFS_TRACE_BAD_BLOCKS,(TSTR("marking block %d bad"TENDSTR), block_no));
34 - retval = mtd->block_markbad(mtd, (loff_t)blocksize * block_no);
35 + retval = mtd_block_markbad(mtd, (loff_t)blocksize * block_no);
36 return (retval) ? YAFFS_FAIL : YAFFS_OK;
39 @@ -336,7 +336,7 @@ int nandmtd1_QueryNANDBlock(struct yaffs
42 retval = nandmtd1_ReadChunkWithTagsFromNAND(dev, chunkNo, NULL, &etags);
43 - etags.block_bad = (mtd->block_isbad)(mtd, addr);
44 + etags.block_bad = mtd_block_isbad(mtd, addr);
45 if (etags.block_bad) {
46 T(YAFFS_TRACE_BAD_BLOCKS,
47 (TSTR("block %d is marked bad"TENDSTR), block_no));
48 --- a/fs/yaffs2/yaffs_vfs_glue.c
49 +++ b/fs/yaffs2/yaffs_vfs_glue.c
50 @@ -2607,8 +2607,8 @@ static void yaffs_MTDPutSuper(struct sup
52 struct mtd_info *mtd = yaffs_dev_to_mtd(yaffs_SuperToDevice(sb));
61 --- a/fs/yaffs2/yaffs_mtdif2.c
62 +++ b/fs/yaffs2/yaffs_mtdif2.c
63 @@ -77,7 +77,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(ya
65 ops.datbuf = (__u8 *)data;
66 ops.oobbuf = (dev->param.inband_tags) ? NULL : packed_tags_ptr;
67 - retval = mtd->write_oob(mtd, addr, &ops);
68 + retval = mtd_write_oob(mtd, addr, &ops);
71 if (!dev->param.inband_tags) {
72 @@ -133,7 +133,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y
74 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
75 if (dev->param.inband_tags || (data && !tags))
76 - retval = mtd->read(mtd, addr, dev->param.total_bytes_per_chunk,
77 + retval = mtd_read(mtd, addr, dev->param.total_bytes_per_chunk,
80 ops.mode = MTD_OPS_AUTO_OOB;
81 @@ -142,7 +142,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y
84 ops.oobbuf = yaffs_dev_to_lc(dev)->spareBuffer;
85 - retval = mtd->read_oob(mtd, addr, &ops);
86 + retval = mtd_read_oob(mtd, addr, &ops);
89 if (!dev->param.inband_tags && data && tags) {
90 @@ -201,7 +201,7 @@ int nandmtd2_MarkNANDBlockBad(struct yaf
91 (TSTR("nandmtd2_MarkNANDBlockBad %d" TENDSTR), block_no));
94 - mtd->block_markbad(mtd,
95 + mtd_block_markbad(mtd,
96 block_no * dev->param.chunks_per_block *
97 dev->param.total_bytes_per_chunk);
99 @@ -221,7 +221,7 @@ int nandmtd2_QueryNANDBlock(struct yaffs
101 (TSTR("nandmtd2_QueryNANDBlock %d" TENDSTR), block_no));
103 - mtd->block_isbad(mtd,
104 + mtd_block_isbad(mtd,
105 block_no * dev->param.chunks_per_block *
106 dev->param.total_bytes_per_chunk);
108 --- a/fs/yaffs2/yaffs_mtdif.h
109 +++ b/fs/yaffs2/yaffs_mtdif.h
110 @@ -31,4 +31,39 @@ int nandmtd_InitialiseNAND(yaffs_dev_t *
111 #define MTD_OPS_AUTO_OOB MTD_OOB_AUTO
114 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0))
115 +static inline int mtd_erase(struct mdt_info *mtd, struct erase_info *ei)
117 + return mtd->erase(mtd, ei);
120 +static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs)
122 + return mtd->block_mark_bad(mtd, ofs);
125 +static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs)
127 + return mtd->block_is_bad(mtd, ofs);
130 +static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from,
131 + struct mtd_oob_ops *ops)
133 + return mtd->read_oob(mtd, from, ops);
136 +static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
137 + struct mtd_oob_ops *ops)
139 + return mtd->write_oob(mtd, to, ops);
142 +static inline void mtd_sync(struct mtd_info *mtd)
150 --- a/fs/yaffs2/yaffs_mtdif.c
151 +++ b/fs/yaffs2/yaffs_mtdif.c
152 @@ -41,7 +41,7 @@ int nandmtd_EraseBlockInNAND(yaffs_dev_t
154 ei.priv = (u_long) dev;
156 - retval = mtd->erase(mtd, &ei);
157 + retval = mtd_erase(mtd, &ei);