mtd/drivers/mtd/nand nand_bbt.c,1.34,1.35

gleixner at infradead.org gleixner at infradead.org
Fri Jul 15 09:53:51 EDT 2005


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

Modified Files:
	nand_bbt.c 
Log Message:
[MTD] NAND: Fix broken bad block scan for 16 bit devices

The previous change to read a single byte from oob breaks the
bad block scan on 16 bit devices, when the byte is on an odd
address. Read the complete oob for now



Index: nand_bbt.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_bbt.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- nand_bbt.c	15 Jul 2005 07:16:41 -0000	1.34
+++ nand_bbt.c	15 Jul 2005 13:53:47 -0000	1.35
@@ -113,8 +113,7 @@
  *
  * Check for a pattern at the given place. Used to search bad block
  * tables and good / bad block identifiers. Same as check_pattern, but 
- * no optional empty check and the pattern is expected to start
- * at offset 0.
+ * no optional empty check
  *
 */
 static int check_short_pattern (uint8_t *buf, struct nand_bbt_descr *td)
@@ -124,7 +123,7 @@
 
 	/* Compare the pattern */
 	for (i = 0; i < td->len; i++) {
-		if (p[i] != td->pattern[i])
+		if (p[td->offs + i] != td->pattern[i])
 			return -1;
 	}
 	return 0;
@@ -335,9 +334,10 @@
 			if (!(bd->options & NAND_BBT_SCANEMPTY)) {
 				size_t retlen;
 				
-				/* No need to read pages fully, just read required OOB bytes */
-				ret = mtd->read_oob(mtd, from + j * mtd->oobblock + bd->offs,
-							readlen, &retlen, buf);
+				/* Read the full oob until read_oob is fixed to 
+				 * handle single byte reads for 16 bit buswidth */
+				ret = mtd->read_oob(mtd, from + j * mtd->oobblock,
+							mtd->oobsize, &retlen, buf);
 				if (ret)
 					return ret;
 





More information about the linux-mtd-cvs mailing list