[Yaffs] patch for using ECC + YAFFS + cvs MTD + 2.4.x

Aras Vaichas arasv@magellan-technology.com
Mon, 13 Dec 2004 16:09:08 +1100


This is a patch for YAFFS source code that allows you to use the 
CONFIG_YAFFS_USE_NANDECC option with a 2.4.x kernel and the latest MTD code. If 
you don't have this patch, the struct member "eccbytes" will not be setup 
correctly and you will get ECC style errors when reading from a NAND device. 
i.e. random single bit flips in large blocks of data

My patch assumes that if CONFIG_YAFFS_USE_OLD_MTD is NOT defined then you must 
be using the latest MTD code and therefore it should work with 2.4.x kernels.

Thanks to Thomas Gleixner for pointing this one out to me.

Aras

# diff -Naur yaffs_mtdif.c.old yaffs_mtdif.c
--- yaffs_mtdif.c.old   2004-12-10 13:06:36.000000000 +1100
+++ yaffs_mtdif.c       2004-12-13 11:30:52.304493960 +1100
@@ -31,7 +31,7 @@

  struct nand_oobinfo yaffs_oobinfo = {
         useecc: 1,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8)) || (!CONFIG_YAFFS_USE_OLD_MTD)
  // this is for versions of mtd nand driver in kernel 2.6.8 and later
         eccbytes: 6,
  #endif