[MTD] [CHIPS] cfi_cmdset_0001.c: Fix a bug in inval_cache_and_wait_for_operation().

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Mar 20 14:59:29 EDT 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=6ac15e92dfd3064ae484e2e823890622476c4356
Commit:     6ac15e92dfd3064ae484e2e823890622476c4356
Parent:     610f75e74b636f933bc3e379a88a10f883b91332
Author:     Graff Yang <graff.yang at gmail.com>
AuthorDate: Mon Mar 2 16:31:29 2009 +0800
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Mar 20 18:32:17 2009 +0000

    [MTD] [CHIPS] cfi_cmdset_0001.c: Fix a bug in inval_cache_and_wait_for_operation().
    
    If the inval_cache_and_wait_for_operation() is re-entered by write operation when erase
    operation is in progress, the chip->erase_suspended will be cleared, this cause the erase
    timeo is not reset and will result time out error for erase.
    
    Signed-off-by: Graff Yang <graff.yang at gmail.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/chips/cfi_cmdset_0001.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index f5ab6fa..c240454 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -1236,10 +1236,14 @@ static int inval_cache_and_wait_for_operation(
 			remove_wait_queue(&chip->wq, &wait);
 			spin_lock(chip->mutex);
 		}
-		if (chip->erase_suspended || chip->write_suspended)  {
-			/* Suspend has occured while sleep: reset timeout */
+		if (chip->erase_suspended && chip_state == FL_ERASING)  {
+			/* Erase suspend occured while sleep: reset timeout */
 			timeo = reset_timeo;
 			chip->erase_suspended = 0;
+		}
+		if (chip->write_suspended && chip_state == FL_WRITING)  {
+			/* Write suspend occured while sleep: reset timeout */
+			timeo = reset_timeo;
 			chip->write_suspended = 0;
 		}
 	}



More information about the linux-mtd-cvs mailing list