mtd: nand: fix build failure and incorrect return from omap_wait()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sun Jun 28 05:59:01 EDT 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=c276aca46d26aa2347320096f8ecdf5016795c14
Commit:     c276aca46d26aa2347320096f8ecdf5016795c14
Parent:     70ec3bb8ea3f8c55b255f41d122c7d4d8c0d00b4
Author:     vimal singh <vimalsingh at ti.com>
AuthorDate: Sat Jun 27 11:07:06 2009 +0530
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Sun Jun 28 10:24:13 2009 +0100

    mtd: nand: fix build failure and incorrect return from omap_wait()
    
    We need to include jiffies.h manually in some cases, and the status
    returned from omap_wait() was broken in two separate ways.
    
    Also add cond_resched() to the loop.
    
    Signed-off-by: Vimal Singh <vimalsingh at ti.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/omap2.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 0cd76f8..ebd07e9 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -11,6 +11,8 @@
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 #include <linux/delay.h>
+#include <linux/jiffies.h>
+#include <linux/sched.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
@@ -541,7 +543,7 @@ static int omap_wait(struct mtd_info *mtd, struct nand_chip *chip)
 	struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
 							mtd);
 	unsigned long timeo = jiffies;
-	int status, state = this->state;
+	int status = NAND_STATUS_FAIL, state = this->state;
 
 	if (state == FL_ERASING)
 		timeo += (HZ * 400) / 1000;
@@ -556,8 +558,9 @@ static int omap_wait(struct mtd_info *mtd, struct nand_chip *chip)
 
 	while (time_before(jiffies, timeo)) {
 		status = __raw_readb(this->IO_ADDR_R);
-		if (!(status & 0x40))
+		if (status & NAND_STATUS_READY)
 			break;
+		cond_resched();
 	}
 	return status;
 }



More information about the linux-mtd-cvs mailing list