Commit bb0eb217 authored by Adrian Hunter's avatar Adrian Hunter Committed by David Woodhouse

[MTD] Define and use MTD_FAIL_ADDR_UNKNOWN instead of 0xffffffff

Signed-off-by: default avatarAdrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent d0e8c47c
...@@ -444,7 +444,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -444,7 +444,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
return -EINVAL; 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 */ /* make a local copy of instr to avoid modifying the caller's struct */
erase = kmalloc(sizeof (struct erase_info), GFP_KERNEL); erase = kmalloc(sizeof (struct erase_info), GFP_KERNEL);
...@@ -493,7 +493,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -493,7 +493,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
/* sanity check: should never happen since /* sanity check: should never happen since
* block alignment has been checked above */ * block alignment has been checked above */
BUG_ON(err == -EINVAL); BUG_ON(err == -EINVAL);
if (erase->fail_addr != 0xffffffff) if (erase->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
instr->fail_addr = erase->fail_addr + offset; instr->fail_addr = erase->fail_addr + offset;
break; break;
} }
......
...@@ -214,7 +214,7 @@ static int part_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -214,7 +214,7 @@ static int part_erase(struct mtd_info *mtd, struct erase_info *instr)
instr->addr += part->offset; instr->addr += part->offset;
ret = part->master->erase(part->master, instr); ret = part->master->erase(part->master, instr);
if (ret) { if (ret) {
if (instr->fail_addr != 0xffffffff) if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
instr->fail_addr -= part->offset; instr->fail_addr -= part->offset;
instr->addr -= part->offset; instr->addr -= part->offset;
} }
...@@ -226,7 +226,7 @@ void mtd_erase_callback(struct erase_info *instr) ...@@ -226,7 +226,7 @@ void mtd_erase_callback(struct erase_info *instr)
if (instr->mtd->erase == part_erase) { if (instr->mtd->erase == part_erase) {
struct mtd_part *part = PART(instr->mtd); 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->fail_addr -= part->offset;
instr->addr -= part->offset; instr->addr -= part->offset;
} }
......
...@@ -2042,7 +2042,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, ...@@ -2042,7 +2042,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
return -EINVAL; return -EINVAL;
} }
instr->fail_addr = 0xffffffff; instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
/* Grab the lock and see if the device is available */ /* Grab the lock and see if the device is available */
nand_get_device(chip, mtd, FL_ERASING); nand_get_device(chip, mtd, FL_ERASING);
......
...@@ -1794,7 +1794,7 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -1794,7 +1794,7 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr)
return -EINVAL; return -EINVAL;
} }
instr->fail_addr = 0xffffffff; instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
/* Grab the lock and see if the device is available */ /* Grab the lock and see if the device is available */
onenand_get_device(mtd, FL_ERASING); onenand_get_device(mtd, FL_ERASING);
......
...@@ -68,7 +68,7 @@ static void jffs2_erase_block(struct jffs2_sb_info *c, ...@@ -68,7 +68,7 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
instr->len = c->sector_size; instr->len = c->sector_size;
instr->callback = jffs2_erase_callback; instr->callback = jffs2_erase_callback;
instr->priv = (unsigned long)(&instr[1]); 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)->jeb = jeb;
((struct erase_priv_struct *)instr->priv)->c = c; ((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 ...@@ -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 /* 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. */ 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 /* We had a device-level failure to erase. Let's see if we've
failed too many times. */ failed too many times. */
if (!jffs2_write_nand_badblock(c, jeb, bad_offset)) { if (!jffs2_write_nand_badblock(c, jeb, bad_offset)) {
......
...@@ -25,8 +25,10 @@ ...@@ -25,8 +25,10 @@
#define MTD_ERASE_DONE 0x08 #define MTD_ERASE_DONE 0x08
#define MTD_ERASE_FAILED 0x10 #define MTD_ERASE_FAILED 0x10
#define MTD_FAIL_ADDR_UNKNOWN 0xffffffff
/* If the erase fails, fail_addr might indicate exactly which block failed. If /* 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. */ specific to any particular block. */
struct erase_info { struct erase_info {
struct mtd_info *mtd; struct mtd_info *mtd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment