diff options
author | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-28 05:01:53 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-29 09:06:50 -0400 |
commit | f4a43cfcecfcaeeaa40a9dbc1d1378298c22446e (patch) | |
tree | 5647ebccb720c9d8ca314c8a3a5f6a660d000019 /drivers/mtd/inftlmount.c | |
parent | 5bd34c091a044d130601370c370f84b1c59f1627 (diff) |
[MTD] Remove silly MTD_WRITE/READ macros
Most of those macros are unused and the used ones just obfuscate
the code. Remove them and fixup all users.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/mtd/inftlmount.c')
-rw-r--r-- | drivers/mtd/inftlmount.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c index f89a03795e76..b4cda7d0a52d 100644 --- a/drivers/mtd/inftlmount.c +++ b/drivers/mtd/inftlmount.c | |||
@@ -57,6 +57,7 @@ static int find_boot_record(struct INFTLrecord *inftl) | |||
57 | unsigned int i, block; | 57 | unsigned int i, block; |
58 | u8 buf[SECTORSIZE]; | 58 | u8 buf[SECTORSIZE]; |
59 | struct INFTLMediaHeader *mh = &inftl->MediaHdr; | 59 | struct INFTLMediaHeader *mh = &inftl->MediaHdr; |
60 | struct mtd_info *mtd = inftl->mbd.mtd; | ||
60 | struct INFTLPartition *ip; | 61 | struct INFTLPartition *ip; |
61 | size_t retlen; | 62 | size_t retlen; |
62 | 63 | ||
@@ -80,8 +81,8 @@ static int find_boot_record(struct INFTLrecord *inftl) | |||
80 | * Check for BNAND header first. Then whinge if it's found | 81 | * Check for BNAND header first. Then whinge if it's found |
81 | * but later checks fail. | 82 | * but later checks fail. |
82 | */ | 83 | */ |
83 | ret = MTD_READ(inftl->mbd.mtd, block * inftl->EraseSize, | 84 | ret = mtd->read(mtd, block * inftl->EraseSize, |
84 | SECTORSIZE, &retlen, buf); | 85 | SECTORSIZE, &retlen, buf); |
85 | /* We ignore ret in case the ECC of the MediaHeader is invalid | 86 | /* We ignore ret in case the ECC of the MediaHeader is invalid |
86 | (which is apparently acceptable) */ | 87 | (which is apparently acceptable) */ |
87 | if (retlen != SECTORSIZE) { | 88 | if (retlen != SECTORSIZE) { |
@@ -106,8 +107,9 @@ static int find_boot_record(struct INFTLrecord *inftl) | |||
106 | } | 107 | } |
107 | 108 | ||
108 | /* To be safer with BIOS, also use erase mark as discriminant */ | 109 | /* To be safer with BIOS, also use erase mark as discriminant */ |
109 | if ((ret = MTD_READOOB(inftl->mbd.mtd, block * inftl->EraseSize + | 110 | if ((ret = mtd->read_oob(mtd, block * inftl->EraseSize + |
110 | SECTORSIZE + 8, 8, &retlen, (char *)&h1) < 0)) { | 111 | SECTORSIZE + 8, 8, &retlen, |
112 | (char *)&h1) < 0)) { | ||
111 | printk(KERN_WARNING "INFTL: ANAND header found at " | 113 | printk(KERN_WARNING "INFTL: ANAND header found at " |
112 | "0x%x in mtd%d, but OOB data read failed " | 114 | "0x%x in mtd%d, but OOB data read failed " |
113 | "(err %d)\n", block * inftl->EraseSize, | 115 | "(err %d)\n", block * inftl->EraseSize, |
@@ -123,8 +125,8 @@ static int find_boot_record(struct INFTLrecord *inftl) | |||
123 | memcpy(mh, buf, sizeof(struct INFTLMediaHeader)); | 125 | memcpy(mh, buf, sizeof(struct INFTLMediaHeader)); |
124 | 126 | ||
125 | /* Read the spare media header at offset 4096 */ | 127 | /* Read the spare media header at offset 4096 */ |
126 | MTD_READ(inftl->mbd.mtd, block * inftl->EraseSize + 4096, | 128 | mtd->read(mtd, block * inftl->EraseSize + 4096, |
127 | SECTORSIZE, &retlen, buf); | 129 | SECTORSIZE, &retlen, buf); |
128 | if (retlen != SECTORSIZE) { | 130 | if (retlen != SECTORSIZE) { |
129 | printk(KERN_WARNING "INFTL: Unable to read spare " | 131 | printk(KERN_WARNING "INFTL: Unable to read spare " |
130 | "Media Header\n"); | 132 | "Media Header\n"); |
@@ -233,7 +235,7 @@ static int find_boot_record(struct INFTLrecord *inftl) | |||
233 | */ | 235 | */ |
234 | instr->addr = ip->Reserved0 * inftl->EraseSize; | 236 | instr->addr = ip->Reserved0 * inftl->EraseSize; |
235 | instr->len = inftl->EraseSize; | 237 | instr->len = inftl->EraseSize; |
236 | MTD_ERASE(inftl->mbd.mtd, instr); | 238 | mtd->erase(mtd, instr); |
237 | } | 239 | } |
238 | if ((ip->lastUnit - ip->firstUnit + 1) < ip->virtualUnits) { | 240 | if ((ip->lastUnit - ip->firstUnit + 1) < ip->virtualUnits) { |
239 | printk(KERN_WARNING "INFTL: Media Header " | 241 | printk(KERN_WARNING "INFTL: Media Header " |
@@ -387,6 +389,7 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) | |||
387 | size_t retlen; | 389 | size_t retlen; |
388 | struct inftl_unittail uci; | 390 | struct inftl_unittail uci; |
389 | struct erase_info *instr = &inftl->instr; | 391 | struct erase_info *instr = &inftl->instr; |
392 | struct mtd_info *mtd = inftl->mbd.mtd; | ||
390 | int physblock; | 393 | int physblock; |
391 | 394 | ||
392 | DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_formatblock(inftl=%p," | 395 | DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_formatblock(inftl=%p," |
@@ -404,8 +407,9 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) | |||
404 | /* Erase one physical eraseblock at a time, even though the NAND api | 407 | /* Erase one physical eraseblock at a time, even though the NAND api |
405 | allows us to group them. This way we if we have a failure, we can | 408 | allows us to group them. This way we if we have a failure, we can |
406 | mark only the failed block in the bbt. */ | 409 | mark only the failed block in the bbt. */ |
407 | for (physblock = 0; physblock < inftl->EraseSize; physblock += instr->len, instr->addr += instr->len) { | 410 | for (physblock = 0; physblock < inftl->EraseSize; |
408 | MTD_ERASE(inftl->mbd.mtd, instr); | 411 | physblock += instr->len, instr->addr += instr->len) { |
412 | mtd->erase(inftl->mbd.mtd, instr); | ||
409 | 413 | ||
410 | if (instr->state == MTD_ERASE_FAILED) { | 414 | if (instr->state == MTD_ERASE_FAILED) { |
411 | printk(KERN_WARNING "INFTL: error while formatting block %d\n", | 415 | printk(KERN_WARNING "INFTL: error while formatting block %d\n", |
@@ -414,10 +418,10 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) | |||
414 | } | 418 | } |
415 | 419 | ||
416 | /* | 420 | /* |
417 | * Check the "freeness" of Erase Unit before updating metadata. | 421 | * Check the "freeness" of Erase Unit before updating metadata. |
418 | * FixMe: is this check really necessary? Since we have check the | 422 | * FixMe: is this check really necessary? Since we have check |
419 | * return code after the erase operation. | 423 | * the return code after the erase operation. |
420 | */ | 424 | */ |
421 | if (check_free_sectors(inftl, instr->addr, instr->len, 1) != 0) | 425 | if (check_free_sectors(inftl, instr->addr, instr->len, 1) != 0) |
422 | goto fail; | 426 | goto fail; |
423 | } | 427 | } |
@@ -429,8 +433,7 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) | |||
429 | uci.Reserved[2] = 0; | 433 | uci.Reserved[2] = 0; |
430 | uci.Reserved[3] = 0; | 434 | uci.Reserved[3] = 0; |
431 | instr->addr = block * inftl->EraseSize + SECTORSIZE * 2; | 435 | instr->addr = block * inftl->EraseSize + SECTORSIZE * 2; |
432 | if (MTD_WRITEOOB(inftl->mbd.mtd, instr->addr + | 436 | if (mtd->write_oob(mtd, instr->addr + 8, 8, &retlen, (char *)&uci) < 0) |
433 | 8, 8, &retlen, (char *)&uci) < 0) | ||
434 | goto fail; | 437 | goto fail; |
435 | return 0; | 438 | return 0; |
436 | fail: | 439 | fail: |
@@ -549,6 +552,7 @@ void INFTL_dumpVUchains(struct INFTLrecord *s) | |||
549 | 552 | ||
550 | int INFTL_mount(struct INFTLrecord *s) | 553 | int INFTL_mount(struct INFTLrecord *s) |
551 | { | 554 | { |
555 | struct mtd_info *mtd = s->mbd.mtd; | ||
552 | unsigned int block, first_block, prev_block, last_block; | 556 | unsigned int block, first_block, prev_block, last_block; |
553 | unsigned int first_logical_block, logical_block, erase_mark; | 557 | unsigned int first_logical_block, logical_block, erase_mark; |
554 | int chain_length, do_format_chain; | 558 | int chain_length, do_format_chain; |
@@ -607,10 +611,11 @@ int INFTL_mount(struct INFTLrecord *s) | |||
607 | break; | 611 | break; |
608 | } | 612 | } |
609 | 613 | ||
610 | if (MTD_READOOB(s->mbd.mtd, block * s->EraseSize + 8, | 614 | if (mtd->read_oob(mtd, block * s->EraseSize + 8, |
611 | 8, &retlen, (char *)&h0) < 0 || | 615 | 8, &retlen, (char *)&h0) < 0 || |
612 | MTD_READOOB(s->mbd.mtd, block * s->EraseSize + | 616 | mtd->read_oob(mtd, block * s->EraseSize + |
613 | 2 * SECTORSIZE + 8, 8, &retlen, (char *)&h1) < 0) { | 617 | 2 * SECTORSIZE + 8, 8, &retlen, |
618 | (char *)&h1) < 0) { | ||
614 | /* Should never happen? */ | 619 | /* Should never happen? */ |
615 | do_format_chain++; | 620 | do_format_chain++; |
616 | break; | 621 | break; |