cfi_cmdset_0001.c: Fix a bug in inval_cache_and_wait_for_operation().
PATCH 1/1 cfi_cmdset_0001.c: Fix a bug in inval_cache_and_wait_for_operation().
From: Graff Yang <[email protected]>
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 <[email protected]>
--- drivers/mtd/chips/cfi_cmdset_0001.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/mtd/chips/cfi_cmdset_0001.c +6 -2
@@ -1223,10 +1223,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 ; } }
Signature · 1 line
1.5.2.5