mtd/drivers/mtd/nand nand.c,1.70,1.71

gleixner at infradead.org gleixner at infradead.org
Mon Mar 29 04:12:59 EST 2004


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

Modified Files:
	nand.c 
Log Message:
rip out erase reset and fix chipnr in erase

Index: nand.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- nand.c	29 Mar 2004 08:36:46 -0000	1.70
+++ nand.c	29 Mar 2004 09:12:56 -0000	1.71
@@ -529,16 +529,13 @@
 
 	/* 
 	 * Grab the lock and see if the device is available 
-	 * For erasing, we keep the spinlock until the
-	 * erase command is written. 
 	*/
 retry:
 	spin_lock_bh (&this->chip_lock);
 
 	if (this->state == FL_READY) {
 		this->state = new_state;
-		if (new_state != FL_ERASING)
-			spin_unlock_bh (&this->chip_lock);
+		spin_unlock_bh (&this->chip_lock);
 		return;
 	}
 
@@ -1171,9 +1168,6 @@
 {
 	int column, page, status, ret = 0, chipnr;
 	struct nand_chip *this = mtd->priv;
-#ifdef CONFIG_MTD_NAND_VERIFY_WRITE
-	int i;
-#endif
 
 	DEBUG (MTD_DEBUG_LEVEL3, "nand_write_oob: to = 0x%08x, len = %i\n", (unsigned int) to, (int) len);
 
@@ -1403,7 +1397,6 @@
 {
 	int page, len, status, pages_per_block, ret, chipnr;
 	struct nand_chip *this = mtd->priv;
-	DECLARE_WAITQUEUE (wait, current);
 
 	DEBUG (MTD_DEBUG_LEVEL3,
 	       "nand_erase: start = 0x%08x, len = %i\n", (unsigned int) instr->addr, (unsigned int) instr->len);
@@ -1464,11 +1457,8 @@
 		this->cmdfunc (mtd, NAND_CMD_ERASE1, -1, page);
 		this->cmdfunc (mtd, NAND_CMD_ERASE2, -1, -1);
 
-		spin_unlock_bh (&this->chip_lock);
 		status = this->waitfunc (mtd, this, FL_ERASING);
 
-		/* Get spinlock, in case we exit */
-		spin_lock_bh (&this->chip_lock);
 		/* See if block erase succeeded */
 		if (status & 0x01) {
 			DEBUG (MTD_DEBUG_LEVEL0, "nand_erase: " "Failed erase, page 0x%08x\n", page);
@@ -1476,35 +1466,15 @@
 			goto erase_exit;
 		}
 		
-		/* Check, if we were interupted */
-		if (this->state == FL_ERASING) {
-			/* Increment page address and decrement length */
-			len -= mtd->erasesize;
-			page += pages_per_block;
-			/* Check, if we cross a chip boundary */
-			if (!(page & this->pagemask)) {
-				chipnr++;
-				this->select_chip(mtd, -1);
-				this->select_chip(mtd, chipnr);
-			}
-		}
-		/* Release the spin lock */
-		spin_unlock_bh (&this->chip_lock);
-erase_retry:
-		spin_lock_bh (&this->chip_lock);
-		/* Check the state and sleep if it changed */
-		if (this->state == FL_ERASING || this->state == FL_READY) {
-			/* Select the NAND device again, if we were interrupted */
-			this->state = FL_ERASING;
+		/* Increment page address and decrement length */
+		len -= mtd->erasesize;
+		page += pages_per_block;
+
+		/* Check, if we cross a chip boundary */
+		if (len && !(page & this->pagemask)) {
+			chipnr++;
+			this->select_chip(mtd, -1);
 			this->select_chip(mtd, chipnr);
-			continue;
-		} else {
-			set_current_state (TASK_UNINTERRUPTIBLE);
-			add_wait_queue (&this->wq, &wait);
-			spin_unlock_bh (&this->chip_lock);
-			schedule ();
-			remove_wait_queue (&this->wq, &wait);
-			goto erase_retry;
 		}
 	}
 	instr->state = MTD_ERASE_DONE;
@@ -1512,7 +1482,6 @@
 erase_exit:
 	/* De-select the NAND device */
 	this->select_chip(mtd, -1);
-	spin_unlock_bh (&this->chip_lock);
 
 	ret = instr->state == MTD_ERASE_DONE ? 0 : -EIO;;
 	/* Do call back function */




More information about the linux-mtd-cvs mailing list