[MTD] Define and use MTD_FAIL_ADDR_UNKNOWN instead of 0xffffffff
authorAdrian Hunter <ext-adrian.hunter@nokia.com>
Tue, 12 Aug 2008 09:40:50 +0000 (12:40 +0300)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Tue, 12 Aug 2008 10:02:15 +0000 (11:02 +0100)
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/mtdconcat.c
drivers/mtd/mtdpart.c
drivers/mtd/nand/nand_base.c
drivers/mtd/onenand/onenand_base.c
fs/jffs2/erase.c
include/linux/mtd/mtd.h

index 2972a5edb73d507e60b9b633b5e85e14a9070074..789842d0e6f21352023729c4037327205dccc067 100644 (file)
@@ -444,7 +444,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
                        return -EINVAL;
        }
 
-       instr->fail_addr = 0xffffffff;
+       instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
 
        /* make a local copy of instr to avoid modifying the caller's struct */
        erase = kmalloc(sizeof (struct erase_info), GFP_KERNEL);
@@ -493,7 +493,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
                        /* sanity check: should never happen since
                         * block alignment has been checked above */
                        BUG_ON(err == -EINVAL);
-                       if (erase->fail_addr != 0xffffffff)
+                       if (erase->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
                                instr->fail_addr = erase->fail_addr + offset;
                        break;
                }
index edb90b58a9b16980bd42066f6026bbd1ca7c0667..8e77e36e75ee33cb8f8271714e4138dd5ce4f7e0 100644 (file)
@@ -214,7 +214,7 @@ static int part_erase(struct mtd_info *mtd, struct erase_info *instr)
        instr->addr += part->offset;
        ret = part->master->erase(part->master, instr);
        if (ret) {
-               if (instr->fail_addr != 0xffffffff)
+               if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
                        instr->fail_addr -= part->offset;
                instr->addr -= part->offset;
        }
@@ -226,7 +226,7 @@ void mtd_erase_callback(struct erase_info *instr)
        if (instr->mtd->erase == part_erase) {
                struct mtd_part *part = PART(instr->mtd);
 
-               if (instr->fail_addr != 0xffffffff)
+               if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
                        instr->fail_addr -= part->offset;
                instr->addr -= part->offset;
        }
index d1129bae6c27d20731ef0ead6b86a863e590e7f4..582280560c89417199bd0a142c2247160cb3f2e0 100644 (file)
@@ -2042,7 +2042,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
                return -EINVAL;
        }
 
-       instr->fail_addr = 0xffffffff;
+       instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
 
        /* Grab the lock and see if the device is available */
        nand_get_device(chip, mtd, FL_ERASING);
index 926cf3a4135d1ca84094c40d018803709d059334..90ed319f26e6843c98d26dafba79762b2fd4abbc 100644 (file)
@@ -1794,7 +1794,7 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr)
                return -EINVAL;
        }
 
-       instr->fail_addr = 0xffffffff;
+       instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
 
        /* Grab the lock and see if the device is available */
        onenand_get_device(mtd, FL_ERASING);
index dddb2a6c9e2cfc087b6becc7f88d9e85ab1d02b4..259461b910afec4542ea5f13af00bf0c63b3bf42 100644 (file)
@@ -68,7 +68,7 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
        instr->len = c->sector_size;
        instr->callback = jffs2_erase_callback;
        instr->priv = (unsigned long)(&instr[1]);
-       instr->fail_addr = 0xffffffff;
+       instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
 
        ((struct erase_priv_struct *)instr->priv)->jeb = jeb;
        ((struct erase_priv_struct *)instr->priv)->c = c;
@@ -175,7 +175,7 @@ static void jffs2_erase_failed(struct jffs2_sb_info *c, struct jffs2_eraseblock
 {
        /* For NAND, if the failure did not occur at the device level for a
           specific physical page, don't bother updating the bad block table. */
-       if (jffs2_cleanmarker_oob(c) && (bad_offset != 0xffffffff)) {
+       if (jffs2_cleanmarker_oob(c) && (bad_offset != MTD_FAIL_ADDR_UNKNOWN)) {
                /* We had a device-level failure to erase.  Let's see if we've
                   failed too many times. */
                if (!jffs2_write_nand_badblock(c, jeb, bad_offset)) {
index 922636548558943d7af9007074cb8d2e7e91fcb0..eae26bb6430ae0e8db2c70385d1b1c72c3e32d5b 100644 (file)
 #define MTD_ERASE_DONE          0x08
 #define MTD_ERASE_FAILED        0x10
 
+#define MTD_FAIL_ADDR_UNKNOWN 0xffffffff
+
 /* If the erase fails, fail_addr might indicate exactly which block failed.  If
-   fail_addr = 0xffffffff, the failure was not at the device level or was not
+   fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not
    specific to any particular block. */
 struct erase_info {
        struct mtd_info *mtd;