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