aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-28 05:01:53 -0400
committerThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-29 09:06:50 -0400
commitf4a43cfcecfcaeeaa40a9dbc1d1378298c22446e (patch)
tree5647ebccb720c9d8ca314c8a3a5f6a660d000019
parent5bd34c091a044d130601370c370f84b1c59f1627 (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>
-rw-r--r--drivers/mtd/inftlcore.c63
-rw-r--r--drivers/mtd/inftlmount.c43
-rw-r--r--drivers/mtd/maps/nettel.c2
-rw-r--r--drivers/mtd/mtdblock.c13
-rw-r--r--drivers/mtd/mtdchar.c4
-rw-r--r--drivers/mtd/nftlcore.c144
-rw-r--r--drivers/mtd/nftlmount.c74
-rw-r--r--fs/jffs/intrep.c15
-rw-r--r--include/linux/mtd/mtd.h16
9 files changed, 195 insertions, 179 deletions
diff --git a/drivers/mtd/inftlcore.c b/drivers/mtd/inftlcore.c
index ddd12993780d..3396f0e1ac5f 100644
--- a/drivers/mtd/inftlcore.c
+++ b/drivers/mtd/inftlcore.c
@@ -197,10 +197,11 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned
197 u16 BlockMap[MAX_SECTORS_PER_UNIT]; 197 u16 BlockMap[MAX_SECTORS_PER_UNIT];
198 unsigned char BlockDeleted[MAX_SECTORS_PER_UNIT]; 198 unsigned char BlockDeleted[MAX_SECTORS_PER_UNIT];
199 unsigned int thisEUN, prevEUN, status; 199 unsigned int thisEUN, prevEUN, status;
200 struct mtd_info *mtd = inftl->mbd.mtd;
200 int block, silly; 201 int block, silly;
201 unsigned int targetEUN; 202 unsigned int targetEUN;
202 struct inftl_oob oob; 203 struct inftl_oob oob;
203 size_t retlen; 204 size_t retlen;
204 205
205 DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_foldchain(inftl=%p,thisVUC=%d," 206 DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_foldchain(inftl=%p,thisVUC=%d,"
206 "pending=%d)\n", inftl, thisVUC, pendingblock); 207 "pending=%d)\n", inftl, thisVUC, pendingblock);
@@ -226,9 +227,9 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned
226 if ((BlockMap[block] != 0xffff) || BlockDeleted[block]) 227 if ((BlockMap[block] != 0xffff) || BlockDeleted[block])
227 continue; 228 continue;
228 229
229 if (MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) 230 if (mtd->read_oob(mtd, (thisEUN * inftl->EraseSize)
230 + (block * SECTORSIZE), 16 , &retlen, 231 + (block * SECTORSIZE), 16 , &retlen,
231 (char *)&oob) < 0) 232 (char *)&oob) < 0)
232 status = SECTOR_IGNORE; 233 status = SECTOR_IGNORE;
233 else 234 else
234 status = oob.b.Status | oob.b.Status1; 235 status = oob.b.Status | oob.b.Status1;
@@ -288,13 +289,14 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned
288 if (BlockMap[block] == BLOCK_NIL) 289 if (BlockMap[block] == BLOCK_NIL)
289 continue; 290 continue;
290 291
291 ret = MTD_READ(inftl->mbd.mtd, (inftl->EraseSize * 292 ret = mtd->read(mtd, (inftl->EraseSize * BlockMap[block]) +
292 BlockMap[block]) + (block * SECTORSIZE), SECTORSIZE, 293 (block * SECTORSIZE), SECTORSIZE, &retlen,
293 &retlen, movebuf); 294 movebuf);
294 if (ret < 0) { 295 if (ret < 0) {
295 ret = MTD_READ(inftl->mbd.mtd, (inftl->EraseSize * 296 ret = mtd->read(mtd,
296 BlockMap[block]) + (block * SECTORSIZE), 297 (inftl->EraseSize * BlockMap[block]) +
297 SECTORSIZE, &retlen, movebuf); 298 (block * SECTORSIZE), SECTORSIZE,
299 &retlen, movebuf);
298 if (ret != -EIO) 300 if (ret != -EIO)
299 DEBUG(MTD_DEBUG_LEVEL1, "INFTL: error went " 301 DEBUG(MTD_DEBUG_LEVEL1, "INFTL: error went "
300 "away on retry?\n"); 302 "away on retry?\n");
@@ -415,6 +417,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block)
415 unsigned int thisVUC = block / (inftl->EraseSize / SECTORSIZE); 417 unsigned int thisVUC = block / (inftl->EraseSize / SECTORSIZE);
416 unsigned int thisEUN, writeEUN, prev_block, status; 418 unsigned int thisEUN, writeEUN, prev_block, status;
417 unsigned long blockofs = (block * SECTORSIZE) & (inftl->EraseSize -1); 419 unsigned long blockofs = (block * SECTORSIZE) & (inftl->EraseSize -1);
420 struct mtd_info *mtd = inftl->mbd.mtd;
418 struct inftl_oob oob; 421 struct inftl_oob oob;
419 struct inftl_bci bci; 422 struct inftl_bci bci;
420 unsigned char anac, nacs, parity; 423 unsigned char anac, nacs, parity;
@@ -434,8 +437,8 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block)
434 silly = MAX_LOOPS; 437 silly = MAX_LOOPS;
435 438
436 while (thisEUN <= inftl->lastEUN) { 439 while (thisEUN <= inftl->lastEUN) {
437 MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) + 440 mtd->read_oob(mtd, (thisEUN * inftl->EraseSize) +
438 blockofs, 8, &retlen, (char *)&bci); 441 blockofs, 8, &retlen, (char *)&bci);
439 442
440 status = bci.Status | bci.Status1; 443 status = bci.Status | bci.Status1;
441 DEBUG(MTD_DEBUG_LEVEL3, "INFTL: status of block %d in " 444 DEBUG(MTD_DEBUG_LEVEL3, "INFTL: status of block %d in "
@@ -522,8 +525,8 @@ hitused:
522 nacs = 0; 525 nacs = 0;
523 thisEUN = inftl->VUtable[thisVUC]; 526 thisEUN = inftl->VUtable[thisVUC];
524 if (thisEUN != BLOCK_NIL) { 527 if (thisEUN != BLOCK_NIL) {
525 MTD_READOOB(inftl->mbd.mtd, thisEUN * inftl->EraseSize 528 mtd->read_oob(mtd, thisEUN * inftl->EraseSize
526 + 8, 8, &retlen, (char *)&oob.u); 529 + 8, 8, &retlen, (char *)&oob.u);
527 anac = oob.u.a.ANAC + 1; 530 anac = oob.u.a.ANAC + 1;
528 nacs = oob.u.a.NACs + 1; 531 nacs = oob.u.a.NACs + 1;
529 } 532 }
@@ -544,8 +547,8 @@ hitused:
544 oob.u.a.parityPerField = parity; 547 oob.u.a.parityPerField = parity;
545 oob.u.a.discarded = 0xaa; 548 oob.u.a.discarded = 0xaa;
546 549
547 MTD_WRITEOOB(inftl->mbd.mtd, writeEUN * inftl->EraseSize + 8, 8, 550 mtd->write_oob(mtd, writeEUN * inftl->EraseSize + 8, 8,
548 &retlen, (char *)&oob.u); 551 &retlen, (char *)&oob.u);
549 552
550 /* Also back up header... */ 553 /* Also back up header... */
551 oob.u.b.virtualUnitNo = cpu_to_le16(thisVUC); 554 oob.u.b.virtualUnitNo = cpu_to_le16(thisVUC);
@@ -555,8 +558,8 @@ hitused:
555 oob.u.b.parityPerField = parity; 558 oob.u.b.parityPerField = parity;
556 oob.u.b.discarded = 0xaa; 559 oob.u.b.discarded = 0xaa;
557 560
558 MTD_WRITEOOB(inftl->mbd.mtd, writeEUN * inftl->EraseSize + 561 mtd->write_oob(mtd, writeEUN * inftl->EraseSize +
559 SECTORSIZE * 4 + 8, 8, &retlen, (char *)&oob.u); 562 SECTORSIZE * 4 + 8, 8, &retlen, (char *)&oob.u);
560 563
561 inftl->PUtable[writeEUN] = inftl->VUtable[thisVUC]; 564 inftl->PUtable[writeEUN] = inftl->VUtable[thisVUC];
562 inftl->VUtable[thisVUC] = writeEUN; 565 inftl->VUtable[thisVUC] = writeEUN;
@@ -576,6 +579,7 @@ hitused:
576 */ 579 */
577static void INFTL_trydeletechain(struct INFTLrecord *inftl, unsigned thisVUC) 580static void INFTL_trydeletechain(struct INFTLrecord *inftl, unsigned thisVUC)
578{ 581{
582 struct mtd_info *mtd = inftl->mbd.mtd;
579 unsigned char BlockUsed[MAX_SECTORS_PER_UNIT]; 583 unsigned char BlockUsed[MAX_SECTORS_PER_UNIT];
580 unsigned char BlockDeleted[MAX_SECTORS_PER_UNIT]; 584 unsigned char BlockDeleted[MAX_SECTORS_PER_UNIT];
581 unsigned int thisEUN, status; 585 unsigned int thisEUN, status;
@@ -606,9 +610,9 @@ static void INFTL_trydeletechain(struct INFTLrecord *inftl, unsigned thisVUC)
606 if (BlockUsed[block] || BlockDeleted[block]) 610 if (BlockUsed[block] || BlockDeleted[block])
607 continue; 611 continue;
608 612
609 if (MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) 613 if (mtd->read_oob(mtd, (thisEUN * inftl->EraseSize)
610 + (block * SECTORSIZE), 8 , &retlen, 614 + (block * SECTORSIZE), 8 , &retlen,
611 (char *)&bci) < 0) 615 (char *)&bci) < 0)
612 status = SECTOR_IGNORE; 616 status = SECTOR_IGNORE;
613 else 617 else
614 status = bci.Status | bci.Status1; 618 status = bci.Status | bci.Status1;
@@ -697,6 +701,7 @@ static int INFTL_deleteblock(struct INFTLrecord *inftl, unsigned block)
697{ 701{
698 unsigned int thisEUN = inftl->VUtable[block / (inftl->EraseSize / SECTORSIZE)]; 702 unsigned int thisEUN = inftl->VUtable[block / (inftl->EraseSize / SECTORSIZE)];
699 unsigned long blockofs = (block * SECTORSIZE) & (inftl->EraseSize - 1); 703 unsigned long blockofs = (block * SECTORSIZE) & (inftl->EraseSize - 1);
704 struct mtd_info *mtd = inftl->mbd.mtd;
700 unsigned int status; 705 unsigned int status;
701 int silly = MAX_LOOPS; 706 int silly = MAX_LOOPS;
702 size_t retlen; 707 size_t retlen;
@@ -706,8 +711,8 @@ static int INFTL_deleteblock(struct INFTLrecord *inftl, unsigned block)
706 "block=%d)\n", inftl, block); 711 "block=%d)\n", inftl, block);
707 712
708 while (thisEUN < inftl->nb_blocks) { 713 while (thisEUN < inftl->nb_blocks) {
709 if (MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) + 714 if (mtd->read_oob(mtd, (thisEUN * inftl->EraseSize) +
710 blockofs, 8, &retlen, (char *)&bci) < 0) 715 blockofs, 8, &retlen, (char *)&bci) < 0)
711 status = SECTOR_IGNORE; 716 status = SECTOR_IGNORE;
712 else 717 else
713 status = bci.Status | bci.Status1; 718 status = bci.Status | bci.Status1;
@@ -741,10 +746,10 @@ foundit:
741 if (thisEUN != BLOCK_NIL) { 746 if (thisEUN != BLOCK_NIL) {
742 loff_t ptr = (thisEUN * inftl->EraseSize) + blockofs; 747 loff_t ptr = (thisEUN * inftl->EraseSize) + blockofs;
743 748
744 if (MTD_READOOB(inftl->mbd.mtd, ptr, 8, &retlen, (char *)&bci) < 0) 749 if (mtd->read_oob(mtd, ptr, 8, &retlen, (char *)&bci) < 0)
745 return -EIO; 750 return -EIO;
746 bci.Status = bci.Status1 = SECTOR_DELETED; 751 bci.Status = bci.Status1 = SECTOR_DELETED;
747 if (MTD_WRITEOOB(inftl->mbd.mtd, ptr, 8, &retlen, (char *)&bci) < 0) 752 if (mtd->write_oob(mtd, ptr, 8, &retlen, (char *)&bci) < 0)
748 return -EIO; 753 return -EIO;
749 INFTL_trydeletechain(inftl, block / (inftl->EraseSize / SECTORSIZE)); 754 INFTL_trydeletechain(inftl, block / (inftl->EraseSize / SECTORSIZE));
750 } 755 }
@@ -805,6 +810,7 @@ static int inftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block,
805 struct INFTLrecord *inftl = (void *)mbd; 810 struct INFTLrecord *inftl = (void *)mbd;
806 unsigned int thisEUN = inftl->VUtable[block / (inftl->EraseSize / SECTORSIZE)]; 811 unsigned int thisEUN = inftl->VUtable[block / (inftl->EraseSize / SECTORSIZE)];
807 unsigned long blockofs = (block * SECTORSIZE) & (inftl->EraseSize - 1); 812 unsigned long blockofs = (block * SECTORSIZE) & (inftl->EraseSize - 1);
813 struct mtd_info *mtd = inftl->mbd.mtd;
808 unsigned int status; 814 unsigned int status;
809 int silly = MAX_LOOPS; 815 int silly = MAX_LOOPS;
810 struct inftl_bci bci; 816 struct inftl_bci bci;
@@ -814,8 +820,8 @@ static int inftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block,
814 "buffer=%p)\n", inftl, block, buffer); 820 "buffer=%p)\n", inftl, block, buffer);
815 821
816 while (thisEUN < inftl->nb_blocks) { 822 while (thisEUN < inftl->nb_blocks) {
817 if (MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) + 823 if (mtd->read_oob(mtd, (thisEUN * inftl->EraseSize) +
818 blockofs, 8, &retlen, (char *)&bci) < 0) 824 blockofs, 8, &retlen, (char *)&bci) < 0)
819 status = SECTOR_IGNORE; 825 status = SECTOR_IGNORE;
820 else 826 else
821 status = bci.Status | bci.Status1; 827 status = bci.Status | bci.Status1;
@@ -853,8 +859,7 @@ foundit:
853 } else { 859 } else {
854 size_t retlen; 860 size_t retlen;
855 loff_t ptr = (thisEUN * inftl->EraseSize) + blockofs; 861 loff_t ptr = (thisEUN * inftl->EraseSize) + blockofs;
856 if (MTD_READ(inftl->mbd.mtd, ptr, SECTORSIZE, &retlen, 862 if (mtd->read(mtd, ptr, SECTORSIZE, &retlen, buffer))
857 buffer))
858 return -EIO; 863 return -EIO;
859 } 864 }
860 return 0; 865 return 0;
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;
436fail: 439fail:
@@ -549,6 +552,7 @@ void INFTL_dumpVUchains(struct INFTLrecord *s)
549 552
550int INFTL_mount(struct INFTLrecord *s) 553int 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;
diff --git a/drivers/mtd/maps/nettel.c b/drivers/mtd/maps/nettel.c
index 20771b2a05e1..0994b5b2e331 100644
--- a/drivers/mtd/maps/nettel.c
+++ b/drivers/mtd/maps/nettel.c
@@ -190,7 +190,7 @@ int nettel_eraseconfig(void)
190 set_current_state(TASK_INTERRUPTIBLE); 190 set_current_state(TASK_INTERRUPTIBLE);
191 add_wait_queue(&wait_q, &wait); 191 add_wait_queue(&wait_q, &wait);
192 192
193 ret = MTD_ERASE(mtd, &nettel_erase); 193 ret = mtd->erase(mtd, &nettel_erase);
194 if (ret) { 194 if (ret) {
195 set_current_state(TASK_RUNNING); 195 set_current_state(TASK_RUNNING);
196 remove_wait_queue(&wait_q, &wait); 196 remove_wait_queue(&wait_q, &wait);
diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c
index 8e50170137e0..9b0bc20e4d8d 100644
--- a/drivers/mtd/mtdblock.c
+++ b/drivers/mtd/mtdblock.c
@@ -71,7 +71,7 @@ static int erase_write (struct mtd_info *mtd, unsigned long pos,
71 set_current_state(TASK_INTERRUPTIBLE); 71 set_current_state(TASK_INTERRUPTIBLE);
72 add_wait_queue(&wait_q, &wait); 72 add_wait_queue(&wait_q, &wait);
73 73
74 ret = MTD_ERASE(mtd, &erase); 74 ret = mtd->erase(mtd, &erase);
75 if (ret) { 75 if (ret) {
76 set_current_state(TASK_RUNNING); 76 set_current_state(TASK_RUNNING);
77 remove_wait_queue(&wait_q, &wait); 77 remove_wait_queue(&wait_q, &wait);
@@ -88,7 +88,7 @@ static int erase_write (struct mtd_info *mtd, unsigned long pos,
88 * Next, writhe data to flash. 88 * Next, writhe data to flash.
89 */ 89 */
90 90
91 ret = MTD_WRITE (mtd, pos, len, &retlen, buf); 91 ret = mtd->write(mtd, pos, len, &retlen, buf);
92 if (ret) 92 if (ret)
93 return ret; 93 return ret;
94 if (retlen != len) 94 if (retlen != len)
@@ -138,7 +138,7 @@ static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos,
138 mtd->name, pos, len); 138 mtd->name, pos, len);
139 139
140 if (!sect_size) 140 if (!sect_size)
141 return MTD_WRITE (mtd, pos, len, &retlen, buf); 141 return mtd->write(mtd, pos, len, &retlen, buf);
142 142
143 while (len > 0) { 143 while (len > 0) {
144 unsigned long sect_start = (pos/sect_size)*sect_size; 144 unsigned long sect_start = (pos/sect_size)*sect_size;
@@ -170,7 +170,8 @@ static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos,
170 mtdblk->cache_offset != sect_start) { 170 mtdblk->cache_offset != sect_start) {
171 /* fill the cache with the current sector */ 171 /* fill the cache with the current sector */
172 mtdblk->cache_state = STATE_EMPTY; 172 mtdblk->cache_state = STATE_EMPTY;
173 ret = MTD_READ(mtd, sect_start, sect_size, &retlen, mtdblk->cache_data); 173 ret = mtd->read(mtd, sect_start, sect_size,
174 &retlen, mtdblk->cache_data);
174 if (ret) 175 if (ret)
175 return ret; 176 return ret;
176 if (retlen != sect_size) 177 if (retlen != sect_size)
@@ -207,7 +208,7 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos,
207 mtd->name, pos, len); 208 mtd->name, pos, len);
208 209
209 if (!sect_size) 210 if (!sect_size)
210 return MTD_READ (mtd, pos, len, &retlen, buf); 211 return mtd->read(mtd, pos, len, &retlen, buf);
211 212
212 while (len > 0) { 213 while (len > 0) {
213 unsigned long sect_start = (pos/sect_size)*sect_size; 214 unsigned long sect_start = (pos/sect_size)*sect_size;
@@ -226,7 +227,7 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos,
226 mtdblk->cache_offset == sect_start) { 227 mtdblk->cache_offset == sect_start) {
227 memcpy (buf, mtdblk->cache_data + offset, size); 228 memcpy (buf, mtdblk->cache_data + offset, size);
228 } else { 229 } else {
229 ret = MTD_READ (mtd, pos, size, &retlen, buf); 230 ret = mtd->read(mtd, pos, size, &retlen, buf);
230 if (ret) 231 if (ret)
231 return ret; 232 return ret;
232 if (retlen != size) 233 if (retlen != size)
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index e75ec5fe7760..b45e7747daa3 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -194,7 +194,7 @@ static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t
194 ret = mtd->read_user_prot_reg(mtd, *ppos, len, &retlen, kbuf); 194 ret = mtd->read_user_prot_reg(mtd, *ppos, len, &retlen, kbuf);
195 break; 195 break;
196 default: 196 default:
197 ret = MTD_READ(mtd, *ppos, len, &retlen, kbuf); 197 ret = mtd->read(mtd, *ppos, len, &retlen, kbuf);
198 } 198 }
199 /* Nand returns -EBADMSG on ecc errors, but it returns 199 /* Nand returns -EBADMSG on ecc errors, but it returns
200 * the data. For our userspace tools it is important 200 * the data. For our userspace tools it is important
@@ -205,7 +205,7 @@ static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t
205 if (!ret || (ret == -EBADMSG)) { 205 if (!ret || (ret == -EBADMSG)) {
206 *ppos += retlen; 206 *ppos += retlen;
207 if (copy_to_user(buf, kbuf, retlen)) { 207 if (copy_to_user(buf, kbuf, retlen)) {
208 kfree(kbuf); 208 kfree(kbuf);
209 return -EFAULT; 209 return -EFAULT;
210 } 210 }
211 else 211 else
diff --git a/drivers/mtd/nftlcore.c b/drivers/mtd/nftlcore.c
index dd03349946c2..359533b33d9b 100644
--- a/drivers/mtd/nftlcore.c
+++ b/drivers/mtd/nftlcore.c
@@ -183,6 +183,7 @@ static u16 NFTL_findfreeblock(struct NFTLrecord *nftl, int desperate )
183 183
184static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned pendingblock ) 184static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned pendingblock )
185{ 185{
186 struct mtd_info *mtd = nftl->mbd.mtd;
186 u16 BlockMap[MAX_SECTORS_PER_UNIT]; 187 u16 BlockMap[MAX_SECTORS_PER_UNIT];
187 unsigned char BlockLastState[MAX_SECTORS_PER_UNIT]; 188 unsigned char BlockLastState[MAX_SECTORS_PER_UNIT];
188 unsigned char BlockFreeFound[MAX_SECTORS_PER_UNIT]; 189 unsigned char BlockFreeFound[MAX_SECTORS_PER_UNIT];
@@ -192,7 +193,7 @@ static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned p
192 unsigned int targetEUN; 193 unsigned int targetEUN;
193 struct nftl_oob oob; 194 struct nftl_oob oob;
194 int inplace = 1; 195 int inplace = 1;
195 size_t retlen; 196 size_t retlen;
196 197
197 memset(BlockMap, 0xff, sizeof(BlockMap)); 198 memset(BlockMap, 0xff, sizeof(BlockMap));
198 memset(BlockFreeFound, 0, sizeof(BlockFreeFound)); 199 memset(BlockFreeFound, 0, sizeof(BlockFreeFound));
@@ -208,21 +209,21 @@ static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned p
208 /* Scan to find the Erase Unit which holds the actual data for each 209 /* Scan to find the Erase Unit which holds the actual data for each
209 512-byte block within the Chain. 210 512-byte block within the Chain.
210 */ 211 */
211 silly = MAX_LOOPS; 212 silly = MAX_LOOPS;
212 targetEUN = BLOCK_NIL; 213 targetEUN = BLOCK_NIL;
213 while (thisEUN <= nftl->lastEUN ) { 214 while (thisEUN <= nftl->lastEUN ) {
214 unsigned int status, foldmark; 215 unsigned int status, foldmark;
215 216
216 targetEUN = thisEUN; 217 targetEUN = thisEUN;
217 for (block = 0; block < nftl->EraseSize / 512; block ++) { 218 for (block = 0; block < nftl->EraseSize / 512; block ++) {
218 MTD_READOOB(nftl->mbd.mtd, 219 mtd->read_oob(mtd, (thisEUN * nftl->EraseSize) +
219 (thisEUN * nftl->EraseSize) + (block * 512), 220 (block * 512), 16 , &retlen,
220 16 , &retlen, (char *)&oob); 221 (char *)&oob);
221 if (block == 2) { 222 if (block == 2) {
222 foldmark = oob.u.c.FoldMark | oob.u.c.FoldMark1; 223 foldmark = oob.u.c.FoldMark | oob.u.c.FoldMark1;
223 if (foldmark == FOLD_MARK_IN_PROGRESS) { 224 if (foldmark == FOLD_MARK_IN_PROGRESS) {
224 DEBUG(MTD_DEBUG_LEVEL1, 225 DEBUG(MTD_DEBUG_LEVEL1,
225 "Write Inhibited on EUN %d\n", thisEUN); 226 "Write Inhibited on EUN %d\n", thisEUN);
226 inplace = 0; 227 inplace = 0;
227 } else { 228 } else {
228 /* There's no other reason not to do inplace, 229 /* There's no other reason not to do inplace,
@@ -231,7 +232,7 @@ static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned p
231 inplace = 1; 232 inplace = 1;
232 } 233 }
233 } 234 }
234 status = oob.b.Status | oob.b.Status1; 235 status = oob.b.Status | oob.b.Status1;
235 BlockLastState[block] = status; 236 BlockLastState[block] = status;
236 237
237 switch(status) { 238 switch(status) {
@@ -326,15 +327,15 @@ static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned p
326 return BLOCK_NIL; 327 return BLOCK_NIL;
327 } 328 }
328 } else { 329 } else {
329 /* We put a fold mark in the chain we are folding only if 330 /* We put a fold mark in the chain we are folding only if we
330 we fold in place to help the mount check code. If we do 331 fold in place to help the mount check code. If we do not fold in
331 not fold in place, it is possible to find the valid 332 place, it is possible to find the valid chain by selecting the
332 chain by selecting the longer one */ 333 longer one */
333 oob.u.c.FoldMark = oob.u.c.FoldMark1 = cpu_to_le16(FOLD_MARK_IN_PROGRESS); 334 oob.u.c.FoldMark = oob.u.c.FoldMark1 = cpu_to_le16(FOLD_MARK_IN_PROGRESS);
334 oob.u.c.unused = 0xffffffff; 335 oob.u.c.unused = 0xffffffff;
335 MTD_WRITEOOB(nftl->mbd.mtd, (nftl->EraseSize * targetEUN) + 2 * 512 + 8, 336 mtd->write_oob(mtd, (nftl->EraseSize * targetEUN) + 2 * 512 + 8,
336 8, &retlen, (char *)&oob.u); 337 8, &retlen, (char *)&oob.u);
337 } 338 }
338 339
339 /* OK. We now know the location of every block in the Virtual Unit Chain, 340 /* OK. We now know the location of every block in the Virtual Unit Chain,
340 and the Erase Unit into which we are supposed to be copying. 341 and the Erase Unit into which we are supposed to be copying.
@@ -351,20 +352,20 @@ static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned p
351 continue; 352 continue;
352 } 353 }
353 354
354 /* copy only in non free block (free blocks can only 355 /* copy only in non free block (free blocks can only
355 happen in case of media errors or deleted blocks) */ 356 happen in case of media errors or deleted blocks) */
356 if (BlockMap[block] == BLOCK_NIL) 357 if (BlockMap[block] == BLOCK_NIL)
357 continue; 358 continue;
358 359
359 ret = MTD_READ(nftl->mbd.mtd, (nftl->EraseSize * BlockMap[block]) + (block * 512), 360 ret = mtd->read(mtd, (nftl->EraseSize * BlockMap[block]) + (block * 512),
360 512, &retlen, movebuf); 361 512, &retlen, movebuf);
361 if (ret < 0) { 362 if (ret < 0) {
362 ret = MTD_READ(nftl->mbd.mtd, (nftl->EraseSize * BlockMap[block]) 363 ret = mtd->read(mtd, (nftl->EraseSize * BlockMap[block])
363 + (block * 512), 512, &retlen, 364 + (block * 512), 512, &retlen,
364 movebuf); 365 movebuf);
365 if (ret != -EIO) 366 if (ret != -EIO)
366 printk("Error went away on retry.\n"); 367 printk("Error went away on retry.\n");
367 } 368 }
368 memset(&oob, 0xff, sizeof(struct nftl_oob)); 369 memset(&oob, 0xff, sizeof(struct nftl_oob));
369 oob.b.Status = oob.b.Status1 = SECTOR_USED; 370 oob.b.Status = oob.b.Status1 = SECTOR_USED;
370 371
@@ -374,13 +375,12 @@ static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned p
374 375
375 } 376 }
376 377
377 /* add the header so that it is now a valid chain */ 378 /* add the header so that it is now a valid chain */
378 oob.u.a.VirtUnitNum = oob.u.a.SpareVirtUnitNum 379 oob.u.a.VirtUnitNum = oob.u.a.SpareVirtUnitNum = cpu_to_le16(thisVUC);
379 = cpu_to_le16(thisVUC); 380 oob.u.a.ReplUnitNum = oob.u.a.SpareReplUnitNum = 0xffff;
380 oob.u.a.ReplUnitNum = oob.u.a.SpareReplUnitNum = 0xffff;
381 381
382 MTD_WRITEOOB(nftl->mbd.mtd, (nftl->EraseSize * targetEUN) + 8, 382 mtd->write_oob(mtd, (nftl->EraseSize * targetEUN) + 8,
383 8, &retlen, (char *)&oob.u); 383 8, &retlen, (char *)&oob.u);
384 384
385 /* OK. We've moved the whole lot into the new block. Now we have to free the original blocks. */ 385 /* OK. We've moved the whole lot into the new block. Now we have to free the original blocks. */
386 386
@@ -397,18 +397,18 @@ static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned p
397 while (thisEUN <= nftl->lastEUN && thisEUN != targetEUN) { 397 while (thisEUN <= nftl->lastEUN && thisEUN != targetEUN) {
398 unsigned int EUNtmp; 398 unsigned int EUNtmp;
399 399
400 EUNtmp = nftl->ReplUnitTable[thisEUN]; 400 EUNtmp = nftl->ReplUnitTable[thisEUN];
401 401
402 if (NFTL_formatblock(nftl, thisEUN) < 0) { 402 if (NFTL_formatblock(nftl, thisEUN) < 0) {
403 /* could not erase : mark block as reserved 403 /* could not erase : mark block as reserved
404 */ 404 */
405 nftl->ReplUnitTable[thisEUN] = BLOCK_RESERVED; 405 nftl->ReplUnitTable[thisEUN] = BLOCK_RESERVED;
406 } else { 406 } else {
407 /* correctly erased : mark it as free */ 407 /* correctly erased : mark it as free */
408 nftl->ReplUnitTable[thisEUN] = BLOCK_FREE; 408 nftl->ReplUnitTable[thisEUN] = BLOCK_FREE;
409 nftl->numfreeEUNs++; 409 nftl->numfreeEUNs++;
410 } 410 }
411 thisEUN = EUNtmp; 411 thisEUN = EUNtmp;
412 } 412 }
413 413
414 /* Make this the new start of chain for thisVUC */ 414 /* Make this the new start of chain for thisVUC */
@@ -474,6 +474,7 @@ static inline u16 NFTL_findwriteunit(struct NFTLrecord *nftl, unsigned block)
474{ 474{
475 u16 lastEUN; 475 u16 lastEUN;
476 u16 thisVUC = block / (nftl->EraseSize / 512); 476 u16 thisVUC = block / (nftl->EraseSize / 512);
477 struct mtd_info *mtd = nftl->mbd.mtd;
477 unsigned int writeEUN; 478 unsigned int writeEUN;
478 unsigned long blockofs = (block * 512) & (nftl->EraseSize -1); 479 unsigned long blockofs = (block * 512) & (nftl->EraseSize -1);
479 size_t retlen; 480 size_t retlen;
@@ -490,21 +491,22 @@ static inline u16 NFTL_findwriteunit(struct NFTLrecord *nftl, unsigned block)
490 */ 491 */
491 lastEUN = BLOCK_NIL; 492 lastEUN = BLOCK_NIL;
492 writeEUN = nftl->EUNtable[thisVUC]; 493 writeEUN = nftl->EUNtable[thisVUC];
493 silly = MAX_LOOPS; 494 silly = MAX_LOOPS;
494 while (writeEUN <= nftl->lastEUN) { 495 while (writeEUN <= nftl->lastEUN) {
495 struct nftl_bci bci; 496 struct nftl_bci bci;
496 size_t retlen; 497 size_t retlen;
497 unsigned int status; 498 unsigned int status;
498 499
499 lastEUN = writeEUN; 500 lastEUN = writeEUN;
500 501
501 MTD_READOOB(nftl->mbd.mtd, (writeEUN * nftl->EraseSize) + blockofs, 502 mtd->read_oob(mtd,
502 8, &retlen, (char *)&bci); 503 (writeEUN * nftl->EraseSize) + blockofs,
504 8, &retlen, (char *)&bci);
503 505
504 DEBUG(MTD_DEBUG_LEVEL2, "Status of block %d in EUN %d is %x\n", 506 DEBUG(MTD_DEBUG_LEVEL2, "Status of block %d in EUN %d is %x\n",
505 block , writeEUN, le16_to_cpu(bci.Status)); 507 block , writeEUN, le16_to_cpu(bci.Status));
506 508
507 status = bci.Status | bci.Status1; 509 status = bci.Status | bci.Status1;
508 switch(status) { 510 switch(status) {
509 case SECTOR_FREE: 511 case SECTOR_FREE:
510 return writeEUN; 512 return writeEUN;
@@ -575,10 +577,10 @@ static inline u16 NFTL_findwriteunit(struct NFTLrecord *nftl, unsigned block)
575 /* We've found a free block. Insert it into the chain. */ 577 /* We've found a free block. Insert it into the chain. */
576 578
577 if (lastEUN != BLOCK_NIL) { 579 if (lastEUN != BLOCK_NIL) {
578 thisVUC |= 0x8000; /* It's a replacement block */ 580 thisVUC |= 0x8000; /* It's a replacement block */
579 } else { 581 } else {
580 /* The first block in a new chain */ 582 /* The first block in a new chain */
581 nftl->EUNtable[thisVUC] = writeEUN; 583 nftl->EUNtable[thisVUC] = writeEUN;
582 } 584 }
583 585
584 /* set up the actual EUN we're writing into */ 586 /* set up the actual EUN we're writing into */
@@ -586,29 +588,29 @@ static inline u16 NFTL_findwriteunit(struct NFTLrecord *nftl, unsigned block)
586 nftl->ReplUnitTable[writeEUN] = BLOCK_NIL; 588 nftl->ReplUnitTable[writeEUN] = BLOCK_NIL;
587 589
588 /* ... and on the flash itself */ 590 /* ... and on the flash itself */
589 MTD_READOOB(nftl->mbd.mtd, writeEUN * nftl->EraseSize + 8, 8, 591 mtd->read_oob(mtd, writeEUN * nftl->EraseSize + 8, 8,
590 &retlen, (char *)&oob.u); 592 &retlen, (char *)&oob.u);
591 593
592 oob.u.a.VirtUnitNum = oob.u.a.SpareVirtUnitNum = cpu_to_le16(thisVUC); 594 oob.u.a.VirtUnitNum = oob.u.a.SpareVirtUnitNum = cpu_to_le16(thisVUC);
593 595
594 MTD_WRITEOOB(nftl->mbd.mtd, writeEUN * nftl->EraseSize + 8, 8, 596 mtd->write_oob(mtd, writeEUN * nftl->EraseSize + 8, 8,
595 &retlen, (char *)&oob.u); 597 &retlen, (char *)&oob.u);
596 598
597 /* we link the new block to the chain only after the 599 /* we link the new block to the chain only after the
598 block is ready. It avoids the case where the chain 600 block is ready. It avoids the case where the chain
599 could point to a free block */ 601 could point to a free block */
600 if (lastEUN != BLOCK_NIL) { 602 if (lastEUN != BLOCK_NIL) {
601 /* Both in our cache... */ 603 /* Both in our cache... */
602 nftl->ReplUnitTable[lastEUN] = writeEUN; 604 nftl->ReplUnitTable[lastEUN] = writeEUN;
603 /* ... and on the flash itself */ 605 /* ... and on the flash itself */
604 MTD_READOOB(nftl->mbd.mtd, (lastEUN * nftl->EraseSize) + 8, 606 mtd->read_oob(mtd, (lastEUN * nftl->EraseSize) + 8,
605 8, &retlen, (char *)&oob.u); 607 8, &retlen, (char *)&oob.u);
606 608
607 oob.u.a.ReplUnitNum = oob.u.a.SpareReplUnitNum 609 oob.u.a.ReplUnitNum = oob.u.a.SpareReplUnitNum
608 = cpu_to_le16(writeEUN); 610 = cpu_to_le16(writeEUN);
609 611
610 MTD_WRITEOOB(nftl->mbd.mtd, (lastEUN * nftl->EraseSize) + 8, 612 mtd->write_oob(mtd, (lastEUN * nftl->EraseSize) + 8,
611 8, &retlen, (char *)&oob.u); 613 8, &retlen, (char *)&oob.u);
612 } 614 }
613 615
614 return writeEUN; 616 return writeEUN;
@@ -652,20 +654,22 @@ static int nftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block,
652 char *buffer) 654 char *buffer)
653{ 655{
654 struct NFTLrecord *nftl = (void *)mbd; 656 struct NFTLrecord *nftl = (void *)mbd;
657 struct mtd_info *mtd = nftl->mbd.mtd;
655 u16 lastgoodEUN; 658 u16 lastgoodEUN;
656 u16 thisEUN = nftl->EUNtable[block / (nftl->EraseSize / 512)]; 659 u16 thisEUN = nftl->EUNtable[block / (nftl->EraseSize / 512)];
657 unsigned long blockofs = (block * 512) & (nftl->EraseSize - 1); 660 unsigned long blockofs = (block * 512) & (nftl->EraseSize - 1);
658 unsigned int status; 661 unsigned int status;
659 int silly = MAX_LOOPS; 662 int silly = MAX_LOOPS;
660 size_t retlen; 663 size_t retlen;
661 struct nftl_bci bci; 664 struct nftl_bci bci;
662 665
663 lastgoodEUN = BLOCK_NIL; 666 lastgoodEUN = BLOCK_NIL;
664 667
665 if (thisEUN != BLOCK_NIL) { 668 if (thisEUN != BLOCK_NIL) {
666 while (thisEUN < nftl->nb_blocks) { 669 while (thisEUN < nftl->nb_blocks) {
667 if (MTD_READOOB(nftl->mbd.mtd, (thisEUN * nftl->EraseSize) + blockofs, 670 if (mtd->read_oob(mtd, (thisEUN * nftl->EraseSize) +
668 8, &retlen, (char *)&bci) < 0) 671 blockofs, 8, &retlen,
672 (char *)&bci) < 0)
669 status = SECTOR_IGNORE; 673 status = SECTOR_IGNORE;
670 else 674 else
671 status = bci.Status | bci.Status1; 675 status = bci.Status | bci.Status1;
@@ -695,7 +699,7 @@ static int nftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block,
695 } 699 }
696 thisEUN = nftl->ReplUnitTable[thisEUN]; 700 thisEUN = nftl->ReplUnitTable[thisEUN];
697 } 701 }
698 } 702 }
699 703
700 the_end: 704 the_end:
701 if (lastgoodEUN == BLOCK_NIL) { 705 if (lastgoodEUN == BLOCK_NIL) {
@@ -704,7 +708,7 @@ static int nftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block,
704 } else { 708 } else {
705 loff_t ptr = (lastgoodEUN * nftl->EraseSize) + blockofs; 709 loff_t ptr = (lastgoodEUN * nftl->EraseSize) + blockofs;
706 size_t retlen; 710 size_t retlen;
707 if (MTD_READ(nftl->mbd.mtd, ptr, 512, &retlen, buffer)) 711 if (mtd->read(mtd, ptr, 512, &retlen, buffer))
708 return -EIO; 712 return -EIO;
709 } 713 }
710 return 0; 714 return 0;
diff --git a/drivers/mtd/nftlmount.c b/drivers/mtd/nftlmount.c
index 90e5e7e97fdc..521b07cd2326 100644
--- a/drivers/mtd/nftlmount.c
+++ b/drivers/mtd/nftlmount.c
@@ -45,6 +45,7 @@ static int find_boot_record(struct NFTLrecord *nftl)
45 size_t retlen; 45 size_t retlen;
46 u8 buf[SECTORSIZE]; 46 u8 buf[SECTORSIZE];
47 struct NFTLMediaHeader *mh = &nftl->MediaHdr; 47 struct NFTLMediaHeader *mh = &nftl->MediaHdr;
48 struct mtd_info *mtd = nftl->mbd.mtd;
48 unsigned int i; 49 unsigned int i;
49 50
50 /* Assume logical EraseSize == physical erasesize for starting the scan. 51 /* Assume logical EraseSize == physical erasesize for starting the scan.
@@ -65,7 +66,8 @@ static int find_boot_record(struct NFTLrecord *nftl)
65 66
66 /* Check for ANAND header first. Then can whinge if it's found but later 67 /* Check for ANAND header first. Then can whinge if it's found but later
67 checks fail */ 68 checks fail */
68 ret = MTD_READ(nftl->mbd.mtd, block * nftl->EraseSize, SECTORSIZE, &retlen, buf); 69 ret = mtd->read(mtd, block * nftl->EraseSize, SECTORSIZE,
70 &retlen, buf);
69 /* We ignore ret in case the ECC of the MediaHeader is invalid 71 /* We ignore ret in case the ECC of the MediaHeader is invalid
70 (which is apparently acceptable) */ 72 (which is apparently acceptable) */
71 if (retlen != SECTORSIZE) { 73 if (retlen != SECTORSIZE) {
@@ -90,8 +92,9 @@ static int find_boot_record(struct NFTLrecord *nftl)
90 } 92 }
91 93
92 /* To be safer with BIOS, also use erase mark as discriminant */ 94 /* To be safer with BIOS, also use erase mark as discriminant */
93 if ((ret = MTD_READOOB(nftl->mbd.mtd, block * nftl->EraseSize + SECTORSIZE + 8, 95 if ((ret = mtd->read_oob(mtd, block * nftl->EraseSize +
94 8, &retlen, (char *)&h1) < 0)) { 96 SECTORSIZE + 8, 8, &retlen,
97 (char *)&h1) < 0)) {
95 printk(KERN_WARNING "ANAND header found at 0x%x in mtd%d, but OOB data read failed (err %d)\n", 98 printk(KERN_WARNING "ANAND header found at 0x%x in mtd%d, but OOB data read failed (err %d)\n",
96 block * nftl->EraseSize, nftl->mbd.mtd->index, ret); 99 block * nftl->EraseSize, nftl->mbd.mtd->index, ret);
97 continue; 100 continue;
@@ -109,8 +112,8 @@ static int find_boot_record(struct NFTLrecord *nftl)
109 } 112 }
110 113
111 /* Finally reread to check ECC */ 114 /* Finally reread to check ECC */
112 if ((ret = MTD_READECC(nftl->mbd.mtd, block * nftl->EraseSize, SECTORSIZE, 115 if ((ret = mtd->read(mtd, block * nftl->EraseSize, SECTORSIZE,
113 &retlen, buf, (char *)&oob, NULL) < 0)) { 116 &retlen, buf) < 0)) {
114 printk(KERN_NOTICE "ANAND header found at 0x%x in mtd%d, but ECC read failed (err %d)\n", 117 printk(KERN_NOTICE "ANAND header found at 0x%x in mtd%d, but ECC read failed (err %d)\n",
115 block * nftl->EraseSize, nftl->mbd.mtd->index, ret); 118 block * nftl->EraseSize, nftl->mbd.mtd->index, ret);
116 continue; 119 continue;
@@ -228,9 +231,9 @@ device is already correct.
228The new DiskOnChip driver already scanned the bad block table. Just query it. 231The new DiskOnChip driver already scanned the bad block table. Just query it.
229 if ((i & (SECTORSIZE - 1)) == 0) { 232 if ((i & (SECTORSIZE - 1)) == 0) {
230 /* read one sector for every SECTORSIZE of blocks */ 233 /* read one sector for every SECTORSIZE of blocks */
231 if ((ret = MTD_READECC(nftl->mbd.mtd, block * nftl->EraseSize + 234 if ((ret = mtd->read(nftl->mbd.mtd, block * nftl->EraseSize +
232 i + SECTORSIZE, SECTORSIZE, &retlen, buf, 235 i + SECTORSIZE, SECTORSIZE, &retlen,
233 (char *)&oob, NULL)) < 0) { 236 buf)) < 0) {
234 printk(KERN_NOTICE "Read of bad sector table failed (err %d)\n", 237 printk(KERN_NOTICE "Read of bad sector table failed (err %d)\n",
235 ret); 238 ret);
236 kfree(nftl->ReplUnitTable); 239 kfree(nftl->ReplUnitTable);
@@ -305,10 +308,11 @@ int NFTL_formatblock(struct NFTLrecord *nftl, int block)
305 unsigned int nb_erases, erase_mark; 308 unsigned int nb_erases, erase_mark;
306 struct nftl_uci1 uci; 309 struct nftl_uci1 uci;
307 struct erase_info *instr = &nftl->instr; 310 struct erase_info *instr = &nftl->instr;
311 struct mtd_info *mtd = nftl->mbd.mtd;
308 312
309 /* Read the Unit Control Information #1 for Wear-Leveling */ 313 /* Read the Unit Control Information #1 for Wear-Leveling */
310 if (MTD_READOOB(nftl->mbd.mtd, block * nftl->EraseSize + SECTORSIZE + 8, 314 if (mtd->read_oob(mtd, block * nftl->EraseSize + SECTORSIZE + 8,
311 8, &retlen, (char *)&uci) < 0) 315 8, &retlen, (char *)&uci) < 0)
312 goto default_uci1; 316 goto default_uci1;
313 317
314 erase_mark = le16_to_cpu ((uci.EraseMark | uci.EraseMark1)); 318 erase_mark = le16_to_cpu ((uci.EraseMark | uci.EraseMark1));
@@ -325,7 +329,7 @@ int NFTL_formatblock(struct NFTLrecord *nftl, int block)
325 instr->mtd = nftl->mbd.mtd; 329 instr->mtd = nftl->mbd.mtd;
326 instr->addr = block * nftl->EraseSize; 330 instr->addr = block * nftl->EraseSize;
327 instr->len = nftl->EraseSize; 331 instr->len = nftl->EraseSize;
328 MTD_ERASE(nftl->mbd.mtd, instr); 332 mtd->erase(mtd, instr);
329 333
330 if (instr->state == MTD_ERASE_FAILED) { 334 if (instr->state == MTD_ERASE_FAILED) {
331 printk("Error while formatting block %d\n", block); 335 printk("Error while formatting block %d\n", block);
@@ -347,8 +351,8 @@ int NFTL_formatblock(struct NFTLrecord *nftl, int block)
347 goto fail; 351 goto fail;
348 352
349 uci.WearInfo = le32_to_cpu(nb_erases); 353 uci.WearInfo = le32_to_cpu(nb_erases);
350 if (MTD_WRITEOOB(nftl->mbd.mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8, 354 if (mtd->write_oob(mtd, block * nftl->EraseSize + SECTORSIZE +
351 &retlen, (char *)&uci) < 0) 355 8, 8, &retlen, (char *)&uci) < 0)
352 goto fail; 356 goto fail;
353 return 0; 357 return 0;
354fail: 358fail:
@@ -369,6 +373,7 @@ fail:
369 * case. */ 373 * case. */
370static void check_sectors_in_chain(struct NFTLrecord *nftl, unsigned int first_block) 374static void check_sectors_in_chain(struct NFTLrecord *nftl, unsigned int first_block)
371{ 375{
376 struct mtd_info *mtd = nftl->mbd.mtd;
372 unsigned int block, i, status; 377 unsigned int block, i, status;
373 struct nftl_bci bci; 378 struct nftl_bci bci;
374 int sectors_per_block; 379 int sectors_per_block;
@@ -378,8 +383,9 @@ static void check_sectors_in_chain(struct NFTLrecord *nftl, unsigned int first_b
378 block = first_block; 383 block = first_block;
379 for (;;) { 384 for (;;) {
380 for (i = 0; i < sectors_per_block; i++) { 385 for (i = 0; i < sectors_per_block; i++) {
381 if (MTD_READOOB(nftl->mbd.mtd, block * nftl->EraseSize + i * SECTORSIZE, 386 if (mtd->read_oob(mtd,
382 8, &retlen, (char *)&bci) < 0) 387 block * nftl->EraseSize + i * SECTORSIZE,
388 8, &retlen, (char *)&bci) < 0)
383 status = SECTOR_IGNORE; 389 status = SECTOR_IGNORE;
384 else 390 else
385 status = bci.Status | bci.Status1; 391 status = bci.Status | bci.Status1;
@@ -398,9 +404,10 @@ static void check_sectors_in_chain(struct NFTLrecord *nftl, unsigned int first_b
398 /* sector not free actually : mark it as SECTOR_IGNORE */ 404 /* sector not free actually : mark it as SECTOR_IGNORE */
399 bci.Status = SECTOR_IGNORE; 405 bci.Status = SECTOR_IGNORE;
400 bci.Status1 = SECTOR_IGNORE; 406 bci.Status1 = SECTOR_IGNORE;
401 MTD_WRITEOOB(nftl->mbd.mtd, 407 mtd->write_oob(mtd, block *
402 block * nftl->EraseSize + i * SECTORSIZE, 408 nftl->EraseSize +
403 8, &retlen, (char *)&bci); 409 i * SECTORSIZE, 8,
410 &retlen, (char *)&bci);
404 } 411 }
405 break; 412 break;
406 default: 413 default:
@@ -485,13 +492,14 @@ static void format_chain(struct NFTLrecord *nftl, unsigned int first_block)
485 * 1. */ 492 * 1. */
486static int check_and_mark_free_block(struct NFTLrecord *nftl, int block) 493static int check_and_mark_free_block(struct NFTLrecord *nftl, int block)
487{ 494{
495 struct mtd_info *mtd = nftl->mbd.mtd;
488 struct nftl_uci1 h1; 496 struct nftl_uci1 h1;
489 unsigned int erase_mark; 497 unsigned int erase_mark;
490 size_t retlen; 498 size_t retlen;
491 499
492 /* check erase mark. */ 500 /* check erase mark. */
493 if (MTD_READOOB(nftl->mbd.mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8, 501 if (mtd->read_oob(mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8,
494 &retlen, (char *)&h1) < 0) 502 &retlen, (char *)&h1) < 0)
495 return -1; 503 return -1;
496 504
497 erase_mark = le16_to_cpu ((h1.EraseMark | h1.EraseMark1)); 505 erase_mark = le16_to_cpu ((h1.EraseMark | h1.EraseMark1));
@@ -505,8 +513,9 @@ static int check_and_mark_free_block(struct NFTLrecord *nftl, int block)
505 h1.EraseMark = cpu_to_le16(ERASE_MARK); 513 h1.EraseMark = cpu_to_le16(ERASE_MARK);
506 h1.EraseMark1 = cpu_to_le16(ERASE_MARK); 514 h1.EraseMark1 = cpu_to_le16(ERASE_MARK);
507 h1.WearInfo = cpu_to_le32(0); 515 h1.WearInfo = cpu_to_le32(0);
508 if (MTD_WRITEOOB(nftl->mbd.mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8, 516 if (mtd->write_oob(mtd,
509 &retlen, (char *)&h1) < 0) 517 block * nftl->EraseSize + SECTORSIZE + 8, 8,
518 &retlen, (char *)&h1) < 0)
510 return -1; 519 return -1;
511 } else { 520 } else {
512#if 0 521#if 0
@@ -517,8 +526,8 @@ static int check_and_mark_free_block(struct NFTLrecord *nftl, int block)
517 SECTORSIZE, 0) != 0) 526 SECTORSIZE, 0) != 0)
518 return -1; 527 return -1;
519 528
520 if (MTD_READOOB(nftl->mbd.mtd, block * nftl->EraseSize + i, 529 if (mtd->read_oob(mtd, block * nftl->EraseSize + i,
521 16, &retlen, buf) < 0) 530 16, &retlen, buf) < 0)
522 return -1; 531 return -1;
523 if (i == SECTORSIZE) { 532 if (i == SECTORSIZE) {
524 /* skip erase mark */ 533 /* skip erase mark */
@@ -544,11 +553,12 @@ static int check_and_mark_free_block(struct NFTLrecord *nftl, int block)
544 */ 553 */
545static int get_fold_mark(struct NFTLrecord *nftl, unsigned int block) 554static int get_fold_mark(struct NFTLrecord *nftl, unsigned int block)
546{ 555{
556 struct mtd_info *mtd = nftl->mbd.mtd;
547 struct nftl_uci2 uci; 557 struct nftl_uci2 uci;
548 size_t retlen; 558 size_t retlen;
549 559
550 if (MTD_READOOB(nftl->mbd.mtd, block * nftl->EraseSize + 2 * SECTORSIZE + 8, 560 if (mtd->read_oob(mtd, block * nftl->EraseSize + 2 * SECTORSIZE + 8,
551 8, &retlen, (char *)&uci) < 0) 561 8, &retlen, (char *)&uci) < 0)
552 return 0; 562 return 0;
553 563
554 return le16_to_cpu((uci.FoldMark | uci.FoldMark1)); 564 return le16_to_cpu((uci.FoldMark | uci.FoldMark1));
@@ -562,6 +572,7 @@ int NFTL_mount(struct NFTLrecord *s)
562 int chain_length, do_format_chain; 572 int chain_length, do_format_chain;
563 struct nftl_uci0 h0; 573 struct nftl_uci0 h0;
564 struct nftl_uci1 h1; 574 struct nftl_uci1 h1;
575 struct mtd_info *mtd = s->mbd.mtd;
565 size_t retlen; 576 size_t retlen;
566 577
567 /* search for NFTL MediaHeader and Spare NFTL Media Header */ 578 /* search for NFTL MediaHeader and Spare NFTL Media Header */
@@ -586,10 +597,13 @@ int NFTL_mount(struct NFTLrecord *s)
586 597
587 for (;;) { 598 for (;;) {
588 /* read the block header. If error, we format the chain */ 599 /* read the block header. If error, we format the chain */
589 if (MTD_READOOB(s->mbd.mtd, block * s->EraseSize + 8, 8, 600 if (mtd->read_oob(mtd,
590 &retlen, (char *)&h0) < 0 || 601 block * s->EraseSize + 8, 8,
591 MTD_READOOB(s->mbd.mtd, block * s->EraseSize + SECTORSIZE + 8, 8, 602 &retlen, (char *)&h0) < 0 ||
592 &retlen, (char *)&h1) < 0) { 603 mtd->read_oob(mtd,
604 block * s->EraseSize +
605 SECTORSIZE + 8, 8,
606 &retlen, (char *)&h1) < 0) {
593 s->ReplUnitTable[block] = BLOCK_NIL; 607 s->ReplUnitTable[block] = BLOCK_NIL;
594 do_format_chain = 1; 608 do_format_chain = 1;
595 break; 609 break;
diff --git a/fs/jffs/intrep.c b/fs/jffs/intrep.c
index 0ef207dfaf6f..5371a403130a 100644
--- a/fs/jffs/intrep.c
+++ b/fs/jffs/intrep.c
@@ -247,7 +247,7 @@ flash_safe_read(struct mtd_info *mtd, loff_t from,
247 D3(printk(KERN_NOTICE "flash_safe_read(%p, %08x, %p, %08x)\n", 247 D3(printk(KERN_NOTICE "flash_safe_read(%p, %08x, %p, %08x)\n",
248 mtd, (unsigned int) from, buf, count)); 248 mtd, (unsigned int) from, buf, count));
249 249
250 res = MTD_READ(mtd, from, count, &retlen, buf); 250 res = mtd->read(mtd, from, count, &retlen, buf);
251 if (retlen != count) { 251 if (retlen != count) {
252 panic("Didn't read all bytes in flash_safe_read(). Returned %d\n", res); 252 panic("Didn't read all bytes in flash_safe_read(). Returned %d\n", res);
253 } 253 }
@@ -262,7 +262,7 @@ flash_read_u32(struct mtd_info *mtd, loff_t from)
262 __u32 ret; 262 __u32 ret;
263 int res; 263 int res;
264 264
265 res = MTD_READ(mtd, from, 4, &retlen, (unsigned char *)&ret); 265 res = mtd->read(mtd, from, 4, &retlen, (unsigned char *)&ret);
266 if (retlen != 4) { 266 if (retlen != 4) {
267 printk("Didn't read all bytes in flash_read_u32(). Returned %d\n", res); 267 printk("Didn't read all bytes in flash_read_u32(). Returned %d\n", res);
268 return 0; 268 return 0;
@@ -282,7 +282,7 @@ flash_safe_write(struct mtd_info *mtd, loff_t to,
282 D3(printk(KERN_NOTICE "flash_safe_write(%p, %08x, %p, %08x)\n", 282 D3(printk(KERN_NOTICE "flash_safe_write(%p, %08x, %p, %08x)\n",
283 mtd, (unsigned int) to, buf, count)); 283 mtd, (unsigned int) to, buf, count));
284 284
285 res = MTD_WRITE(mtd, to, count, &retlen, buf); 285 res = mtd->write(mtd, to, count, &retlen, buf);
286 if (retlen != count) { 286 if (retlen != count) {
287 printk("Didn't write all bytes in flash_safe_write(). Returned %d\n", res); 287 printk("Didn't write all bytes in flash_safe_write(). Returned %d\n", res);
288 } 288 }
@@ -300,9 +300,9 @@ flash_safe_writev(struct mtd_info *mtd, const struct kvec *vecs,
300 300
301 D3(printk(KERN_NOTICE "flash_safe_writev(%p, %08x, %p)\n", 301 D3(printk(KERN_NOTICE "flash_safe_writev(%p, %08x, %p)\n",
302 mtd, (unsigned int) to, vecs)); 302 mtd, (unsigned int) to, vecs));
303 303
304 if (mtd->writev) { 304 if (mtd->writev) {
305 res = MTD_WRITEV(mtd, vecs, iovec_cnt, to, &retlen); 305 res = mtd->writev(mtd, vecs, iovec_cnt, to, &retlen);
306 return res ? res : retlen; 306 return res ? res : retlen;
307 } 307 }
308 /* Not implemented writev. Repeatedly use write - on the not so 308 /* Not implemented writev. Repeatedly use write - on the not so
@@ -312,7 +312,8 @@ flash_safe_writev(struct mtd_info *mtd, const struct kvec *vecs,
312 retlen=0; 312 retlen=0;
313 313
314 for (i=0; !res && i<iovec_cnt; i++) { 314 for (i=0; !res && i<iovec_cnt; i++) {
315 res = MTD_WRITE(mtd, to, vecs[i].iov_len, &retlen_a, vecs[i].iov_base); 315 res = mtd->write(mtd, to, vecs[i].iov_len, &retlen_a,
316 vecs[i].iov_base);
316 if (retlen_a != vecs[i].iov_len) { 317 if (retlen_a != vecs[i].iov_len) {
317 printk("Didn't write all bytes in flash_safe_writev(). Returned %d\n", res); 318 printk("Didn't write all bytes in flash_safe_writev(). Returned %d\n", res);
318 if (i != iovec_cnt-1) 319 if (i != iovec_cnt-1)
@@ -393,7 +394,7 @@ flash_erase_region(struct mtd_info *mtd, loff_t start,
393 set_current_state(TASK_UNINTERRUPTIBLE); 394 set_current_state(TASK_UNINTERRUPTIBLE);
394 add_wait_queue(&wait_q, &wait); 395 add_wait_queue(&wait_q, &wait);
395 396
396 if (MTD_ERASE(mtd, erase) < 0) { 397 if (mtd->erase(mtd, erase) < 0) {
397 set_current_state(TASK_RUNNING); 398 set_current_state(TASK_RUNNING);
398 remove_wait_queue(&wait_q, &wait); 399 remove_wait_queue(&wait_q, &wait);
399 kfree(erase); 400 kfree(erase);
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 48a9df21ab11..4970c2e96fbf 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -199,20 +199,6 @@ int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
199int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs, 199int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs,
200 unsigned long count, loff_t from, size_t *retlen); 200 unsigned long count, loff_t from, size_t *retlen);
201 201
202#define MTD_ERASE(mtd, args...) (*(mtd->erase))(mtd, args)
203#define MTD_POINT(mtd, a,b,c,d) (*(mtd->point))(mtd, a,b,c, (u_char **)(d))
204#define MTD_UNPOINT(mtd, arg) (*(mtd->unpoint))(mtd, (u_char *)arg)
205#define MTD_READ(mtd, args...) (*(mtd->read))(mtd, args)
206#define MTD_WRITE(mtd, args...) (*(mtd->write))(mtd, args)
207#define MTD_READV(mtd, args...) (*(mtd->readv))(mtd, args)
208#define MTD_WRITEV(mtd, args...) (*(mtd->writev))(mtd, args)
209#define MTD_READECC(mtd, args...) (*(mtd->read_ecc))(mtd, args)
210#define MTD_WRITEECC(mtd, args...) (*(mtd->write_ecc))(mtd, args)
211#define MTD_READOOB(mtd, args...) (*(mtd->read_oob))(mtd, args)
212#define MTD_WRITEOOB(mtd, args...) (*(mtd->write_oob))(mtd, args)
213#define MTD_SYNC(mtd) do { if (mtd->sync) (*(mtd->sync))(mtd); } while (0)
214
215
216#ifdef CONFIG_MTD_PARTITIONS 202#ifdef CONFIG_MTD_PARTITIONS
217void mtd_erase_callback(struct erase_info *instr); 203void mtd_erase_callback(struct erase_info *instr);
218#else 204#else
@@ -233,7 +219,7 @@ static inline void mtd_erase_callback(struct erase_info *instr)
233 219
234#ifdef CONFIG_MTD_DEBUG 220#ifdef CONFIG_MTD_DEBUG
235#define DEBUG(n, args...) \ 221#define DEBUG(n, args...) \
236 do { \ 222 do { \
237 if (n <= CONFIG_MTD_DEBUG_VERBOSE) \ 223 if (n <= CONFIG_MTD_DEBUG_VERBOSE) \
238 printk(KERN_INFO args); \ 224 printk(KERN_INFO args); \
239 } while(0) 225 } while(0)