Patchwork [MTD,NAND] : fix omap2.c compile failure and warning

login
register
mail settings
Submitter Singh, Vimal
Date June 27, 2009, 5:37 a.m.
Message ID <63536.192.168.10.89.1246081026.squirrel@dbdmail.itg.ti.com>
Download mbox | patch
Permalink /patch/29225/
State New, archived
Headers show

Comments

Singh, Vimal - June 27, 2009, 5:37 a.m.
> The 'status' you return in the case that you _have_ gone through the
> loop is still wrong though, isn't it?
Yes, I have corrected that in below patch. Its my bad, I did not fix it
previously.

Signed-off-by: Vimal Singh <vimalsingh at ti.com>
Signed-off-by: Ming Lei <tom.leiming at gmail.com>
---
David Woodhouse - June 27, 2009, 7:45 a.m.
On Sat, 2009-06-27 at 11:07 +0530, vimal singh wrote:
> > The 'status' you return in the case that you _have_ gone through the
> > loop is still wrong though, isn't it?
> Yes, I have corrected that in below patch. Its my bad, I did not fix it
> previously.
> 
> Signed-off-by: Vimal Singh <vimalsingh at ti.com>
> Signed-off-by: Ming Lei <tom.leiming at gmail.com>

Er, did he? And please put proper email addresses in. If you can't find
an @ sign on your keyboard, cut and paste it from elsewhere.

> @@ -558,6 +560,7 @@ static int omap_wait(struct mtd_info *mtd, struct nand_chip
>  		status = __raw_readb(this->IO_ADDR_R);
> -		if (!(status & 0x40))
> +		if (status & NAND_STATUS_READY)
>  			break;

Hm... now you're polling the PASS/FAIL bit in the status, not the
READY/BUSY bit. I suspect that's not going to work too well...

Patch

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 0cd76f8..3b6e6ad 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
 	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;
@@ -558,6 +560,7 @@  static int omap_wait(struct mtd_info *mtd, struct nand_chip
 		status = __raw_readb(this->IO_ADDR_R);
-		if (!(status & 0x40))
+		if (status & NAND_STATUS_READY)
 			break;
+		cond_resched();
 	}
 	return status;
 }