Merge branch 'master' of ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2
[yaffs2.git] / yaffs_mtdif_multi.c
index 265dd789eb02d55094277183adf7cf722ecfd092..5b0e4fed26dfb6b681635e3f4a96ed9eb7152e5b 100644 (file)
@@ -1,8 +1,7 @@
 /*
  * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
  *
- * Copyright (C) 2002-2011 Aleph One Ltd.
- *   for Toby Churchill Ltd and Brightstar Engineering
+ * Copyright (C) 2002-2018 Aleph One Ltd.
  *
  * Created by Charles Manning <charles@aleph1.co.uk>
  *
 #include "linux/kernel.h"
 #include "linux/version.h"
 #include "linux/types.h"
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
+#include "uapi/linux/major.h"
+#endif
 
 #include "yaffs_trace.h"
 #include "yaffs_guts.h"
 #include "yaffs_linux.h"
 
-
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0))
 #define MTD_OPS_AUTO_OOB MTD_OOB_AUTO
 #endif
@@ -78,6 +79,20 @@ static       int yaffs_mtd_write(struct yaffs_dev *dev, int nand_chunk,
        struct mtd_oob_ops ops;
        int retval;
 
+       yaffs_trace(YAFFS_TRACE_MTD,
+                       "yaffs_mtd_write(%p, %d, %p, %d, %p, %d)\n",
+                       dev, nand_chunk, data, data_len, oob, oob_len);
+
+       if (!data || !data_len) {
+               data = NULL;
+               data_len = 0;
+       }
+
+       if (!oob || !oob_len) {
+               oob = NULL;
+               oob_len = 0;
+       }
+
        addr = ((loff_t) nand_chunk) * dev->param.total_bytes_per_chunk;
        memset(&ops, 0, sizeof(ops));
        ops.mode = MTD_OPS_AUTO_OOB;
@@ -201,7 +216,7 @@ static int yaffs_mtd_check_bad(struct yaffs_dev *dev, int block_no)
        int blocksize = dev->param.chunks_per_block * dev->param.total_bytes_per_chunk;
        int retval;
 
-       yaffs_trace(YAFFS_TRACE_BAD_BLOCKS, "checking block %d bad", block_no);
+       yaffs_trace(YAFFS_TRACE_MTD, "checking block %d bad", block_no);
 
        retval = mtd_block_isbad(mtd, (loff_t) blocksize * block_no);
        return (retval) ? YAFFS_FAIL : YAFFS_OK;