aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHuang Shijie <b32955@freescale.com>2013-01-29 21:03:56 -0500
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2013-02-04 02:36:39 -0500
commit6d2559f8bc297597f8058ee75bdb8060edd5214d (patch)
treedb9bc5312953e6a72e79289f90099600639f4441 /drivers
parent1648eaaa1575ea686acb82fb8cb3d8839764ef2c (diff)
mtd: fix the wrong timeo for panic_nand_wait()
The panic_nand_wait() expects the timeo in ms and not in jiffies. But in nand_wait(), the timeo for panic_nand_wait() is assigned with wrong value(jiffies + some delay). The timeo should be set like the panic_nand_write() does. This patch passes timeo in ms to panic_nand_wait(). And this patch also passes timeo in jiffies(converted by msecs_to_jiffies) to time_before() which makes the code more readable. Signed-off-by: Huang Shijie <b32955@freescale.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nand/nand_base.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 8323ac991ad1..a8c1fb475fa6 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -825,13 +825,8 @@ static void panic_nand_wait(struct mtd_info *mtd, struct nand_chip *chip,
825static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip) 825static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
826{ 826{
827 827
828 unsigned long timeo = jiffies;
829 int status, state = chip->state; 828 int status, state = chip->state;
830 829 unsigned long timeo = (state == FL_ERASING ? 400 : 20);
831 if (state == FL_ERASING)
832 timeo += (HZ * 400) / 1000;
833 else
834 timeo += (HZ * 20) / 1000;
835 830
836 led_trigger_event(nand_led_trigger, LED_FULL); 831 led_trigger_event(nand_led_trigger, LED_FULL);
837 832
@@ -849,6 +844,7 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
849 if (in_interrupt() || oops_in_progress) 844 if (in_interrupt() || oops_in_progress)
850 panic_nand_wait(mtd, chip, timeo); 845 panic_nand_wait(mtd, chip, timeo);
851 else { 846 else {
847 timeo = jiffies + msecs_to_jiffies(timeo);
852 while (time_before(jiffies, timeo)) { 848 while (time_before(jiffies, timeo)) {
853 if (chip->dev_ready) { 849 if (chip->dev_ready) {
854 if (chip->dev_ready(mtd)) 850 if (chip->dev_ready(mtd))