Merge tag 'for-linus-20130301' of git://git.infradead.org/linux-mtd
[linux-3.10.git] / drivers / mtd / nand / nand_base.c
index 3766682..4321415 100644 (file)
@@ -825,13 +825,8 @@ 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 timeo = jiffies;
        int status, state = chip->state;
-
-       if (state == FL_ERASING)
-               timeo += (HZ * 400) / 1000;
-       else
-               timeo += (HZ * 20) / 1000;
+       unsigned long timeo = (state == FL_ERASING ? 400 : 20);
 
        led_trigger_event(nand_led_trigger, LED_FULL);
 
@@ -849,6 +844,7 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
        if (in_interrupt() || oops_in_progress)
                panic_nand_wait(mtd, chip, timeo);
        else {
+               timeo = jiffies + msecs_to_jiffies(timeo);
                while (time_before(jiffies, timeo)) {
                        if (chip->dev_ready) {
                                if (chip->dev_ready(mtd))