[Yaffs] [PATCH] remove support of the OLD MTD

Top Page
Attachments:
Message as email
+ (text/plain)
+ remove-old-mtd-support.diff (text/plain)
Delete this message
Reply to this message
Author: Luc Van Oostenryck
Date:  
To: yaffs-list
Subject: [Yaffs] [PATCH] remove support of the OLD MTD
This patch remove the support for the old pre-yaffs aware MTD.
diff-tree a57f5d901f7a2d30d88303881cfb94255c7fc230 (from 9be5d5e9e729d92c335160caa596c51102870fa7)
Author: Luc Van Oostenryck <>
Date: Wed Jul 27 00:49:22 2005 +0200

    Remove the support for the old MTD.


diff --git a/fs/yaffs2/yaffs_fs.c b/fs/yaffs2/yaffs_fs.c
--- a/fs/yaffs2/yaffs_fs.c
+++ b/fs/yaffs2/yaffs_fs.c
@@ -1389,14 +1389,12 @@ static struct super_block *yaffs_interna
             if(!mtd->erase ||
                !mtd->block_isbad ||
                !mtd->block_markbad ||
                !mtd->read  ||
                !mtd->write ||
-#ifndef CONFIG_YAFFS_USE_OLD_MTD
                !mtd->write_ecc ||
                !mtd->read_ecc ||
-#endif
                !mtd->read_oob ||
                !mtd->write_oob )
             {
                 T(YAFFS_TRACE_ALWAYS,("yaffs: MTD device does not support required functions\n"));;
                 return NULL;
@@ -1412,14 +1410,12 @@ static struct super_block *yaffs_interna
         {
             // Check for V1 style functions
             if(!mtd->erase ||
                !mtd->read  ||
                !mtd->write ||
-#ifndef CONFIG_YAFFS_USE_OLD_MTD
                !mtd->write_ecc ||
                !mtd->read_ecc ||
-#endif
                !mtd->read_oob ||
                !mtd->write_oob )
             {
                 T(YAFFS_TRACE_ALWAYS,("yaffs: MTD device does not support required functions\n"));;
                 return NULL;
diff --git a/fs/yaffs2/yaffs_mtdif.c b/fs/yaffs2/yaffs_mtdif.c
--- a/fs/yaffs2/yaffs_mtdif.c
+++ b/fs/yaffs2/yaffs_mtdif.c
@@ -21,14 +21,11 @@ const char *yaffs_mtdif_c_version = "$Id
 #include "yaffs_mtdif.h"


 #include "linux/mtd/mtd.h"
 #include "linux/types.h"
 #include "linux/time.h"
-
-#ifndef    CONFIG_YAFFS_USE_OLD_MTD
 #include "linux/mtd/nand.h"
-#endif


 struct nand_oobinfo yaffs_oobinfo = {
     useecc: 1,
     eccpos: {8, 9, 10, 13, 14, 15}
 };
@@ -46,28 +43,24 @@ int nandmtd_WriteChunkToNAND(yaffs_Devic

    
     loff_t addr = ((loff_t)chunkInNAND) * dev->nBytesPerChunk;

    
     __u8 *spareAsBytes = (__u8 *)spare;


-#ifndef    CONFIG_YAFFS_USE_OLD_MTD
     if(data && spare)
     {
         if(dev->useNANDECC)
             mtd->write_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,&yaffs_oobinfo);
         else
             mtd->write_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,&yaffs_noeccinfo);
     }
     else
     {
-#endif
     if(data)
         retval = mtd->write(mtd,addr,dev->nBytesPerChunk,&dummy,data);
     if(spare)
         retval = mtd->write_oob(mtd,addr,YAFFS_BYTES_PER_SPARE,&dummy,spareAsBytes);
-#ifndef    CONFIG_YAFFS_USE_OLD_MTD
     }
-#endif


     if (retval == 0)
         return YAFFS_OK;
     else
         return YAFFS_FAIL;
@@ -81,11 +74,10 @@ int nandmtd_ReadChunkFromNAND(yaffs_Devi

    
     loff_t addr = ((loff_t)chunkInNAND) * dev->nBytesPerChunk;

    
     __u8 *spareAsBytes = (__u8 *)spare;

    
-#ifndef    CONFIG_YAFFS_USE_OLD_MTD
     if(data && spare)
     {
         if(dev->useNANDECC)
         {   // Careful, this call adds 2 ints to the end of the spare data.  Calling function should
             // allocate enough memory for spare, i.e. [YAFFS_BYTES_PER_SPARE+2*sizeof(int)].
@@ -96,18 +88,15 @@ int nandmtd_ReadChunkFromNAND(yaffs_Devi
             retval = mtd->read_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,&yaffs_noeccinfo);
         }
     }
     else
     {
-#endif
     if(data)
         retval = mtd->read(mtd,addr,dev->nBytesPerChunk,&dummy,data);
     if(spare)
         retval = mtd->read_oob(mtd,addr,YAFFS_BYTES_PER_SPARE,&dummy,spareAsBytes);
-#ifndef    CONFIG_YAFFS_USE_OLD_MTD
     }
-#endif


     if (retval == 0)
         return YAFFS_OK;
     else
         return YAFFS_FAIL;
diff --git a/fs/yaffs2/yaffs_mtdif2.c b/fs/yaffs2/yaffs_mtdif2.c
--- a/fs/yaffs2/yaffs_mtdif2.c
+++ b/fs/yaffs2/yaffs_mtdif2.c
@@ -47,29 +47,25 @@ int nandmtd2_WriteChunkWithTagsToNAND(ya
     if(tags)
     {
         yaffs_PackTags2(&pt,tags);
     }


-#ifndef    CONFIG_YAFFS_USE_OLD_MTD
     if(data && tags)
     {
         if(dev->useNANDECC)
           retval = mtd->write_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,(__u8 *)&pt,NULL);
         else
           retval = mtd->write_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,(__u8 *)&pt,NULL);
     }
     else
     {
-#endif
     if(data)
         retval = mtd->write(mtd,addr,dev->nBytesPerChunk,&dummy,data);
     if(tags)
         retval = mtd->write_oob(mtd,addr,mtd->oobsize,&dummy,(__u8 *)&pt);

        
-#ifndef    CONFIG_YAFFS_USE_OLD_MTD
     }
-#endif


     if (retval == 0)
         return YAFFS_OK;
     else
         return YAFFS_FAIL;
@@ -86,11 +82,10 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y

    
     yaffs_PackedTags2 pt;


     T(YAFFS_TRACE_MTD,(TSTR("nandmtd2_ReadChunkWithTagsToNAND chunk %d data %p tags %p" TENDSTR),chunkInNAND,data,tags));    


-#ifndef    CONFIG_YAFFS_USE_OLD_MTD
     if(data && tags)
     {
         if(dev->useNANDECC)
         {
                 retval = mtd->read_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,dev->spareBuffer,NULL);            
@@ -100,18 +95,15 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y
             retval = mtd->read_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,dev->spareBuffer,NULL);
         }
     }
     else
     {
-#endif
     if(data)
         retval = mtd->read(mtd,addr,dev->nBytesPerChunk,&dummy,data);
     if(tags)
         retval = mtd->read_oob(mtd,addr,mtd->oobsize,&dummy,dev->spareBuffer);
-#ifndef    CONFIG_YAFFS_USE_OLD_MTD
     }
-#endif


     memcpy(&pt,dev->spareBuffer,sizeof(pt));


     if(tags)
     yaffs_UnpackTags2(tags,&pt);