mtd/drivers/mtd/nand nand_base.c,1.109,1.110

dbrown at infradead.org dbrown at infradead.org
Wed Jun 30 11:17:44 EDT 2004


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

Modified Files:
	nand_base.c 
Log Message:
Add ability for callers to localize multi-block erase failures to a specific eraseblock.  (NAND only)


Index: nand_base.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_base.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -r1.109 -r1.110
--- nand_base.c	24 Jun 2004 12:39:35 -0000	1.109
+++ nand_base.c	30 Jun 2004 15:17:41 -0000	1.110
@@ -2036,6 +2036,8 @@
 		return -EINVAL;
 	}
 
+	instr->fail_addr = 0xffffffff;
+
 	/* Grab the lock and see if the device is available */
 	nand_get_chip (this, mtd, FL_ERASING);
 
@@ -2083,6 +2085,7 @@
 		if (status & 0x01) {
 			DEBUG (MTD_DEBUG_LEVEL0, "nand_erase: " "Failed erase, page 0x%08x\n", page);
 			instr->state = MTD_ERASE_FAILED;
+			instr->fail_addr = (page << this->page_shift);
 			goto erase_exit;
 		}
 		
@@ -2184,10 +2187,14 @@
 static int nand_block_markbad (struct mtd_info *mtd, loff_t ofs)
 {
 	struct nand_chip *this = mtd->priv;
-		
-	/* Check for invalid offset */
-	if (ofs > mtd->size) 
-		return -EINVAL;
+	int ret;
+
+        if ((ret = nand_block_isbad(mtd, ofs))) {
+        	/* If it was bad already, return success and do nothing. */
+		if (ret > 0)
+			return 0;
+        	return ret;
+        }
 
 	return this->block_markbad(mtd, ofs);
 }





More information about the linux-mtd-cvs mailing list