[Yaffs] Minor yaffs2 cleanup patches

Top Page
Attachments:
Message as email
+ (text/plain)
+ yaffs2_build_warning.patch (text/x-patch)
+ yaffs2_write_size.patch (text/x-patch)
Delete this message
Reply to this message
Author: Andre Renaud
Date:  
To: yaffs
Subject: [Yaffs] Minor yaffs2 cleanup patches
Here are two patches which are really just cosmetic. One is to use the
WRITE_SIZE macro that is defined at the top of yaffs_fs.c, so that you
don't need loads of #ifdef code further down. I think this code used to
be in place, but was possibly reverted accidentally at some point.
Another is a minor compile warning cleanup.

Andre


--
Bluewater Systems Ltd - ARM Technology Solutions Centre

       Andre Renaud                             Bluewater Systems Ltd
Phone: +64 3 3779127 (Aus 1 800 148 751)        Level 17, 119 Armagh St
Fax:   +64 3 3779135                            PO Box 13889
Email:                  Christchurch
Web:   http://www.bluewatersys.com              New Zealand

Index: yaffs_fs.c
===================================================================
--- yaffs_fs.c    (revision 1416)
+++ yaffs_fs.c    (working copy)
@@ -2097,7 +2080,7 @@
     unsigned rg = 0, mask_bitfield;
     char *end;
     char *mask_name;
-    char *x; 
+    const char *x; 
     char substring[MAX_MASK_NAME_LENGTH+1];
     int i;
     int done = 0;

Index: yaffs_fs.c
===================================================================
--- yaffs_fs.c    (revision 1416)
+++ yaffs_fs.c    (working copy)
@@ -1657,22 +1657,14 @@
 #ifdef CONFIG_YAFFS_AUTO_YAFFS2


     if (yaffsVersion == 1 && 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
-        mtd->writesize >= 2048) {
-#else
-        mtd->oobblock >= 2048) {
-#endif
+            WRITE_SIZE (mtd) >= 2048) {
         T(YAFFS_TRACE_ALWAYS,("yaffs: auto selecting yaffs2\n"));
         yaffsVersion = 2;
     }    

    
     /* Added NCB 26/5/2006 for completeness */
     if (yaffsVersion == 2 && 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
-        mtd->writesize == 512) {
-#else
-        mtd->oobblock == 512) {
-#endif
+            WRITE_SIZE (mtd) == 512) {
         T(YAFFS_TRACE_ALWAYS,("yaffs: auto selecting yaffs1\n"));
         yaffsVersion = 1;
     }    
@@ -1698,11 +1690,7 @@
             return NULL;
         }


-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
-        if (mtd->writesize < YAFFS_MIN_YAFFS2_CHUNK_SIZE ||
-#else
-        if (mtd->oobblock < YAFFS_MIN_YAFFS2_CHUNK_SIZE ||
-#endif
+                if (WRITE_SIZE (mtd) < YAFFS_MIN_YAFFS2_CHUNK_SIZE ||
             mtd->oobsize < YAFFS_MIN_YAFFS2_SPARE_SIZE) {
             T(YAFFS_TRACE_ALWAYS,
               ("yaffs: MTD device does not have the "
@@ -1777,13 +1765,8 @@
         dev->queryNANDBlock = nandmtd2_QueryNANDBlock;
         dev->spareBuffer = YMALLOC(mtd->oobsize);
         dev->isYaffs2 = 1;
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
-        dev->nDataBytesPerChunk = mtd->writesize;
-        dev->nChunksPerBlock = mtd->erasesize / mtd->writesize;
-#else
-        dev->nDataBytesPerChunk = mtd->oobblock;
-        dev->nChunksPerBlock = mtd->erasesize / mtd->oobblock;
-#endif
+                dev->nDataBytesPerChunk = WRITE_SIZE (mtd);
+                dev->nChunksPerBlock = mtd->erasesize / WRITE_SIZE (mtd);
         nBlocks = mtd->size / mtd->erasesize;


         dev->nCheckpointReservedBlocks = CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS;