Commit 6ac15e92 authored by Graff Yang's avatar Graff Yang Committed by David Woodhouse

[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: default avatarGraff Yang <graff.yang@gmail.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 610f75e7
...@@ -1236,10 +1236,14 @@ static int inval_cache_and_wait_for_operation( ...@@ -1236,10 +1236,14 @@ static int inval_cache_and_wait_for_operation(
remove_wait_queue(&chip->wq, &wait); remove_wait_queue(&chip->wq, &wait);
spin_lock(chip->mutex); spin_lock(chip->mutex);
} }
if (chip->erase_suspended || chip->write_suspended) { if (chip->erase_suspended && chip_state == FL_ERASING) {
/* Suspend has occured while sleep: reset timeout */ /* Erase suspend occured while sleep: reset timeout */
timeo = reset_timeo; timeo = reset_timeo;
chip->erase_suspended = 0; 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; chip->write_suspended = 0;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment