diff options
Diffstat (limited to 'drivers/mtd/inftlmount.c')
-rw-r--r-- | drivers/mtd/inftlmount.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c index b4cda7d0a52d..8f6006f1a519 100644 --- a/drivers/mtd/inftlmount.c +++ b/drivers/mtd/inftlmount.c | |||
@@ -43,6 +43,11 @@ | |||
43 | 43 | ||
44 | char inftlmountrev[]="$Revision: 1.18 $"; | 44 | char inftlmountrev[]="$Revision: 1.18 $"; |
45 | 45 | ||
46 | extern int inftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len, | ||
47 | size_t *retlen, uint8_t *buf); | ||
48 | extern int inftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len, | ||
49 | size_t *retlen, uint8_t *buf); | ||
50 | |||
46 | /* | 51 | /* |
47 | * find_boot_record: Find the INFTL Media Header and its Spare copy which | 52 | * find_boot_record: Find the INFTL Media Header and its Spare copy which |
48 | * contains the various device information of the INFTL partition and | 53 | * contains the various device information of the INFTL partition and |
@@ -107,9 +112,9 @@ static int find_boot_record(struct INFTLrecord *inftl) | |||
107 | } | 112 | } |
108 | 113 | ||
109 | /* To be safer with BIOS, also use erase mark as discriminant */ | 114 | /* To be safer with BIOS, also use erase mark as discriminant */ |
110 | if ((ret = mtd->read_oob(mtd, block * inftl->EraseSize + | 115 | if ((ret = inftl_read_oob(mtd, block * inftl->EraseSize + |
111 | SECTORSIZE + 8, 8, &retlen, | 116 | SECTORSIZE + 8, 8, &retlen, |
112 | (char *)&h1) < 0)) { | 117 | (char *)&h1) < 0)) { |
113 | printk(KERN_WARNING "INFTL: ANAND header found at " | 118 | printk(KERN_WARNING "INFTL: ANAND header found at " |
114 | "0x%x in mtd%d, but OOB data read failed " | 119 | "0x%x in mtd%d, but OOB data read failed " |
115 | "(err %d)\n", block * inftl->EraseSize, | 120 | "(err %d)\n", block * inftl->EraseSize, |
@@ -363,8 +368,8 @@ static int check_free_sectors(struct INFTLrecord *inftl, unsigned int address, | |||
363 | return -1; | 368 | return -1; |
364 | 369 | ||
365 | if (check_oob) { | 370 | if (check_oob) { |
366 | if(mtd->read_oob(mtd, address, mtd->oobsize, | 371 | if(inftl_read_oob(mtd, address, mtd->oobsize, |
367 | &retlen, &buf[SECTORSIZE]) < 0) | 372 | &retlen, &buf[SECTORSIZE]) < 0) |
368 | return -1; | 373 | return -1; |
369 | if (memcmpb(buf + SECTORSIZE, 0xff, mtd->oobsize) != 0) | 374 | if (memcmpb(buf + SECTORSIZE, 0xff, mtd->oobsize) != 0) |
370 | return -1; | 375 | return -1; |
@@ -433,7 +438,7 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) | |||
433 | uci.Reserved[2] = 0; | 438 | uci.Reserved[2] = 0; |
434 | uci.Reserved[3] = 0; | 439 | uci.Reserved[3] = 0; |
435 | instr->addr = block * inftl->EraseSize + SECTORSIZE * 2; | 440 | instr->addr = block * inftl->EraseSize + SECTORSIZE * 2; |
436 | if (mtd->write_oob(mtd, instr->addr + 8, 8, &retlen, (char *)&uci) < 0) | 441 | if (inftl_write_oob(mtd, instr->addr + 8, 8, &retlen, (char *)&uci) < 0) |
437 | goto fail; | 442 | goto fail; |
438 | return 0; | 443 | return 0; |
439 | fail: | 444 | fail: |
@@ -611,11 +616,11 @@ int INFTL_mount(struct INFTLrecord *s) | |||
611 | break; | 616 | break; |
612 | } | 617 | } |
613 | 618 | ||
614 | if (mtd->read_oob(mtd, block * s->EraseSize + 8, | 619 | if (inftl_read_oob(mtd, block * s->EraseSize + 8, |
615 | 8, &retlen, (char *)&h0) < 0 || | 620 | 8, &retlen, (char *)&h0) < 0 || |
616 | mtd->read_oob(mtd, block * s->EraseSize + | 621 | inftl_read_oob(mtd, block * s->EraseSize + |
617 | 2 * SECTORSIZE + 8, 8, &retlen, | 622 | 2 * SECTORSIZE + 8, 8, &retlen, |
618 | (char *)&h1) < 0) { | 623 | (char *)&h1) < 0) { |
619 | /* Should never happen? */ | 624 | /* Should never happen? */ |
620 | do_format_chain++; | 625 | do_format_chain++; |
621 | break; | 626 | break; |