Patchwork [1/2] mtd: nand: panic_nand_wait expects timeout in ms.

login
register
mail settings
Submitter Johan Gunnarsson
Date May 21, 2012, 8:42 a.m.
Message ID <1337589758-8775-2-git-send-email-johan.gunnarsson@axis.com>
Download mbox | patch
Permalink /patch/160334/
State New
Headers show

Comments

Johan Gunnarsson - May 21, 2012, 8:42 a.m.
Signed-off-by: Johan Gunnarsson <johan.gunnarsson@axis.com>
---
 drivers/mtd/nand/nand_base.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

Patch

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index eb88d8b..b927e64 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -867,14 +867,16 @@  static void panic_nand_wait(struct mtd_info *mtd, struct nand_chip *chip,
  */
 static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
 {
-
+	unsigned long timeout_ms;
 	unsigned long timeo = jiffies;
 	int status, state = chip->state;
 
 	if (state == FL_ERASING)
-		timeo += (HZ * 400) / 1000;
+		timeout_ms = 400;
 	else
-		timeo += (HZ * 20) / 1000;
+		timeout_ms = 20;
+
+	timeo += (HZ * timeout_ms) / 1000;
 
 	led_trigger_event(nand_led_trigger, LED_FULL);
 
@@ -890,7 +892,7 @@  static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
 		chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);
 
 	if (in_interrupt() || oops_in_progress)
-		panic_nand_wait(mtd, chip, timeo);
+		panic_nand_wait(mtd, chip, timeout_ms);
 	else {
 		while (time_before(jiffies, timeo)) {
 			if (chip->dev_ready) {