mtd/drivers/mtd/chips cfi_cmdset_0001.c,1.161,1.162

David Woodhouse dwmw2 at infradead.org
Thu Nov 11 06:13:22 EST 2004


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

Modified Files:
	cfi_cmdset_0001.c 
Log Message:
Restore oldstate to FL_READY on resume (or suspend failure). 


Index: cfi_cmdset_0001.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0001.c,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -r1.161 -r1.162
--- cfi_cmdset_0001.c	5 Nov 2004 22:41:04 -0000	1.161
+++ cfi_cmdset_0001.c	11 Nov 2004 11:13:19 -0000	1.162
@@ -1976,9 +1976,18 @@
 				 * as the whole point is that nobody can do anything
 				 * with the chip now anyway.
 				 */
+			} else {
+				/* There seems to be an operation pending. We must wait for it. */
+				printk(KERN_NOTICE "Flash device refused suspend due to pending operation (oldstate %d)\n", chip->oldstate);
+				ret = -EAGAIN;
 			}
 			break;
 		default:
+			/* Should we actually wait? Once upon a time these routines weren't
+			   allowed to. Or should we return -EAGAIN, because the upper layers
+			   ought to have already shut down anything which was using the device
+			   anyway? The latter for now. */
+			printk(KERN_NOTICE "Flash device refused suspend due to active operation (state %d)\n", chip->oldstate);
 			ret = -EAGAIN;
 		case FL_PM_SUSPENDED:
 			break;
@@ -1999,6 +2008,7 @@
 				   because we're returning failure, and it didn't
 				   get power cycled */
 				chip->state = chip->oldstate;
+				chip->oldstate = FL_READY;
 				wake_up(&chip->wq);
 			}
 			spin_unlock(chip->mutex);
@@ -2024,7 +2034,7 @@
 		/* Go to known state. Chip may have been power cycled */
 		if (chip->state == FL_PM_SUSPENDED) {
 			map_write(map, CMD(0xFF), cfi->chips[i].start);
-			chip->state = FL_READY;
+			chip->oldstate = chip->state = FL_READY;
 			wake_up(&chip->wq);
 		}
 





More information about the linux-mtd-cvs mailing list