mtd: nand: fix multi-chip suspend problem

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Nov 30 07:59:02 EST 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=6b0d9a84124937f048bcb8b21313152b23063978
Commit:     6b0d9a84124937f048bcb8b21313152b23063978
Parent:     4a58948669702639db7acecfa2105c3172d85c93
Author:     Li Yang <leoli at freescale.com>
AuthorDate: Tue Nov 17 14:45:49 2009 -0800
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Nov 30 11:41:24 2009 +0000

    mtd: nand: fix multi-chip suspend problem
    
    Symptom:
    device_suspend(): mtd_cls_suspend+0x0/0x58 returns -11
    PM: Device mtd14 failed to suspend: error -11
    PM: Some devices failed to suspend
    
    This patch enables other chips to be suspended if the active chip of
    the controller has been suspended.
    
    Signed-off-by: Jin Qing <b24347 at freescale.com>
    Signed-off-by: Li Yang <leoli at freescale.com>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/nand_base.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 724cb2c..8f2958f 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -740,8 +740,14 @@ nand_get_device(struct nand_chip *chip, struct mtd_info *mtd, int new_state)
 		return 0;
 	}
 	if (new_state == FL_PM_SUSPENDED) {
-		spin_unlock(lock);
-		return (chip->state == FL_PM_SUSPENDED) ? 0 : -EAGAIN;
+		if (chip->controller->active->state == FL_PM_SUSPENDED) {
+			chip->state = FL_PM_SUSPENDED;
+			spin_unlock(lock);
+			return 0;
+		} else {
+			spin_unlock(lock);
+			return -EAGAIN;
+		}
 	}
 	set_current_state(TASK_UNINTERRUPTIBLE);
 	add_wait_queue(wq, &wait);



More information about the linux-mtd-cvs mailing list