Add Waldemar's patches for Linux 3.2
[yaffs2.git] / yaffs_mtdif2_multi.c
index 10b7a4fec27631d2113c6b9d125ad2a121af64fc..18ac9921985ee7a3ffef684d4698cd2e54ae921d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
  *
- * Copyright (C) 2002-2010 Aleph One Ltd.
+ * Copyright (C) 2002-2011 Aleph One Ltd.
  *   for Toby Churchill Ltd and Brightstar Engineering
  *
  * Created by Charles Manning <charles@aleph1.co.uk>
 
 #include "yaffs_linux.h"
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0))
+#define MTD_OPS_AUTO_OOB MTD_OOB_AUTO
+#endif
+
+
+
 /* NB For use with inband tags....
  * We assume that the data buffer is of size total_bytes_per_chunk so
  * that we can also use it to load the tags.
@@ -75,7 +81,7 @@ int nandmtd2_write_chunk_tags(struct yaffs_dev *dev, int nand_chunk,
        }
 
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
-       ops.mode = MTD_OOB_AUTO;
+       ops.mode = MTD_OPS_AUTO_OOB;
        ops.ooblen = (dev->param.inband_tags) ? 0 : packed_tags_size;
        ops.len = dev->param.total_bytes_per_chunk;
        ops.ooboffs = 0;
@@ -129,7 +135,7 @@ int nandmtd2_read_chunk_tags(struct yaffs_dev *dev, int nand_chunk,
 
                if (!data) {
                        local_data = 1;
-                       data = yaffs_get_temp_buffer(dev, __LINE__);
+                       data = yaffs_get_temp_buffer(dev);
                }
 
        }
@@ -139,7 +145,7 @@ int nandmtd2_read_chunk_tags(struct yaffs_dev *dev, int nand_chunk,
                retval = mtd->read(mtd, addr, dev->param.total_bytes_per_chunk,
                                   &dummy, data);
        else if (tags) {
-               ops.mode = MTD_OOB_AUTO;
+               ops.mode = MTD_OPS_AUTO_OOB;
                ops.ooblen = packed_tags_size;
                ops.len = data ? dev->data_bytes_per_chunk : packed_tags_size;
                ops.ooboffs = 0;
@@ -182,7 +188,7 @@ int nandmtd2_read_chunk_tags(struct yaffs_dev *dev, int nand_chunk,
        }
 
        if (local_data)
-               yaffs_release_temp_buffer(dev, data, __LINE__);
+               yaffs_release_temp_buffer(dev, data);
 
        if (tags && retval == -EBADMSG
            && tags->ecc_result == YAFFS_ECC_RESULT_NO_ERROR) {