mtd/drivers/mtd/nand nand_bbt.c,1.15,1.16

gleixner at infradead.org gleixner at infradead.org
Tue Jun 22 05:30:46 EDT 2004


Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv3760

Modified Files:
	nand_bbt.c 
Log Message:
Fix write of bbt with contents saving

Index: nand_bbt.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_bbt.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- nand_bbt.c	16 Jun 2004 15:27:42 -0000	1.15
+++ nand_bbt.c	22 Jun 2004 09:30:43 -0000	1.16
@@ -482,13 +482,16 @@
 		bbtoffs = chip * (numblocks >> 2);
 		
 		to = ((loff_t) page) << this->page_shift;
+
+		memcpy (&oobinfo, this->autooob, sizeof(oobinfo));
+		oobinfo.useecc = MTD_NANDECC_PLACEONLY;
 		
 		/* Must we save the block contents ? */
 		if (td->options & NAND_BBT_SAVECONTENT) {
 			/* Make it block aligned */
 			to &= ~((loff_t) ((1 << this->erase_shift) - 1));
-			res = mtd->read_ecc (mtd, to, len, &retlen, buf, NULL, this->autooob);
 			len = 1 << this->erase_shift;
+			res = mtd->read_ecc (mtd, to, len, &retlen, buf, &buf[len], &oobinfo);
 			if (res < 0) {
 				if (retlen != len) {
 					printk (KERN_INFO "nand_bbt: Error reading block for writing the bad block table\n");
@@ -496,14 +499,6 @@
 				}
 				printk (KERN_WARNING "nand_bbt: ECC error while reading block for writing bad block table\n");
 			}
-			res = mtd->read_ecc (mtd, to, (len >> this->page_shift) * mtd->oobsize, &retlen, buf, NULL, this->autooob);
-			if (res < 0) {
-				if (retlen != len) {
-					printk (KERN_INFO "nand_bbt: Error reading oob data for writing the bad block table\n");
-					return res;
-				}
-				printk (KERN_WARNING "nand_bbt: ECC error while reading oob data for writing bad block table\n");
-			}
 			/* Calc the byte offset in the buffer */
 			offs = page - (int)(to >> this->page_shift);
 			offs <<= this->page_shift;
@@ -547,9 +542,6 @@
 			return res;
 		}
 	
-		memcpy (&oobinfo, this->autooob, sizeof(oobinfo));
-		oobinfo.useecc = MTD_NANDECC_PLACE;
-	
 		res = mtd->write_ecc (mtd, to, len, &retlen, buf, &buf[len], &oobinfo);
 		if (res < 0) {
 			printk (KERN_WARNING "nand_bbt: Error while writing bad block table %d\n", res);





More information about the linux-mtd-cvs mailing list