Skip to content

Commit bb0eb21

Browse files
Adrian HunterDavid Woodhouse
authored andcommitted
[MTD] Define and use MTD_FAIL_ADDR_UNKNOWN instead of 0xffffffff
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent d0e8c47 commit bb0eb21

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

drivers/mtd/mtdconcat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
444444
return -EINVAL;
445445
}
446446

447-
instr->fail_addr = 0xffffffff;
447+
instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
448448

449449
/* make a local copy of instr to avoid modifying the caller's struct */
450450
erase = kmalloc(sizeof (struct erase_info), GFP_KERNEL);
@@ -493,7 +493,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
493493
/* sanity check: should never happen since
494494
* block alignment has been checked above */
495495
BUG_ON(err == -EINVAL);
496-
if (erase->fail_addr != 0xffffffff)
496+
if (erase->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
497497
instr->fail_addr = erase->fail_addr + offset;
498498
break;
499499
}

drivers/mtd/mtdpart.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static int part_erase(struct mtd_info *mtd, struct erase_info *instr)
214214
instr->addr += part->offset;
215215
ret = part->master->erase(part->master, instr);
216216
if (ret) {
217-
if (instr->fail_addr != 0xffffffff)
217+
if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
218218
instr->fail_addr -= part->offset;
219219
instr->addr -= part->offset;
220220
}
@@ -226,7 +226,7 @@ void mtd_erase_callback(struct erase_info *instr)
226226
if (instr->mtd->erase == part_erase) {
227227
struct mtd_part *part = PART(instr->mtd);
228228

229-
if (instr->fail_addr != 0xffffffff)
229+
if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
230230
instr->fail_addr -= part->offset;
231231
instr->addr -= part->offset;
232232
}

drivers/mtd/nand/nand_base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
20422042
return -EINVAL;
20432043
}
20442044

2045-
instr->fail_addr = 0xffffffff;
2045+
instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
20462046

20472047
/* Grab the lock and see if the device is available */
20482048
nand_get_device(chip, mtd, FL_ERASING);

drivers/mtd/onenand/onenand_base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1794,7 +1794,7 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr)
17941794
return -EINVAL;
17951795
}
17961796

1797-
instr->fail_addr = 0xffffffff;
1797+
instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
17981798

17991799
/* Grab the lock and see if the device is available */
18001800
onenand_get_device(mtd, FL_ERASING);

fs/jffs2/erase.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
6868
instr->len = c->sector_size;
6969
instr->callback = jffs2_erase_callback;
7070
instr->priv = (unsigned long)(&instr[1]);
71-
instr->fail_addr = 0xffffffff;
71+
instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
7272

7373
((struct erase_priv_struct *)instr->priv)->jeb = jeb;
7474
((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
175175
{
176176
/* For NAND, if the failure did not occur at the device level for a
177177
specific physical page, don't bother updating the bad block table. */
178-
if (jffs2_cleanmarker_oob(c) && (bad_offset != 0xffffffff)) {
178+
if (jffs2_cleanmarker_oob(c) && (bad_offset != MTD_FAIL_ADDR_UNKNOWN)) {
179179
/* We had a device-level failure to erase. Let's see if we've
180180
failed too many times. */
181181
if (!jffs2_write_nand_badblock(c, jeb, bad_offset)) {

include/linux/mtd/mtd.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
#define MTD_ERASE_DONE 0x08
2626
#define MTD_ERASE_FAILED 0x10
2727

28+
#define MTD_FAIL_ADDR_UNKNOWN 0xffffffff
29+
2830
/* If the erase fails, fail_addr might indicate exactly which block failed. If
29-
fail_addr = 0xffffffff, the failure was not at the device level or was not
31+
fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not
3032
specific to any particular block. */
3133
struct erase_info {
3234
struct mtd_info *mtd;

0 commit comments

Comments
 (0)