@@ -197,10 +197,11 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned
197197 u16 BlockMap [MAX_SECTORS_PER_UNIT ];
198198 unsigned char BlockDeleted [MAX_SECTORS_PER_UNIT ];
199199 unsigned int thisEUN , prevEUN , status ;
200+ struct mtd_info * mtd = inftl -> mbd .mtd ;
200201 int block , silly ;
201202 unsigned int targetEUN ;
202203 struct inftl_oob oob ;
203- size_t retlen ;
204+ size_t retlen ;
204205
205206 DEBUG (MTD_DEBUG_LEVEL3 , "INFTL: INFTL_foldchain(inftl=%p,thisVUC=%d,"
206207 "pending=%d)\n" , inftl , thisVUC , pendingblock );
@@ -226,9 +227,9 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned
226227 if ((BlockMap [block ] != 0xffff ) || BlockDeleted [block ])
227228 continue ;
228229
229- if (MTD_READOOB ( inftl -> mbd . mtd , (thisEUN * inftl -> EraseSize )
230- + (block * SECTORSIZE ), 16 , & retlen ,
231- (char * )& oob ) < 0 )
230+ if (mtd -> read_oob ( mtd , (thisEUN * inftl -> EraseSize )
231+ + (block * SECTORSIZE ), 16 , & retlen ,
232+ (char * )& oob ) < 0 )
232233 status = SECTOR_IGNORE ;
233234 else
234235 status = oob .b .Status | oob .b .Status1 ;
@@ -288,13 +289,14 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned
288289 if (BlockMap [block ] == BLOCK_NIL )
289290 continue ;
290291
291- ret = MTD_READ ( inftl -> mbd . mtd , (inftl -> EraseSize *
292- BlockMap [ block ]) + (block * SECTORSIZE ), SECTORSIZE ,
293- & retlen , movebuf );
292+ ret = mtd -> read ( mtd , (inftl -> EraseSize * BlockMap [ block ]) +
293+ (block * SECTORSIZE ), SECTORSIZE , & retlen ,
294+ movebuf );
294295 if (ret < 0 ) {
295- ret = MTD_READ (inftl -> mbd .mtd , (inftl -> EraseSize *
296- BlockMap [block ]) + (block * SECTORSIZE ),
297- SECTORSIZE , & retlen , movebuf );
296+ ret = mtd -> read (mtd ,
297+ (inftl -> EraseSize * BlockMap [block ]) +
298+ (block * SECTORSIZE ), SECTORSIZE ,
299+ & retlen , movebuf );
298300 if (ret != - EIO )
299301 DEBUG (MTD_DEBUG_LEVEL1 , "INFTL: error went "
300302 "away on retry?\n" );
@@ -415,6 +417,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block)
415417 unsigned int thisVUC = block / (inftl -> EraseSize / SECTORSIZE );
416418 unsigned int thisEUN , writeEUN , prev_block , status ;
417419 unsigned long blockofs = (block * SECTORSIZE ) & (inftl -> EraseSize - 1 );
420+ struct mtd_info * mtd = inftl -> mbd .mtd ;
418421 struct inftl_oob oob ;
419422 struct inftl_bci bci ;
420423 unsigned char anac , nacs , parity ;
@@ -434,8 +437,8 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block)
434437 silly = MAX_LOOPS ;
435438
436439 while (thisEUN <= inftl -> lastEUN ) {
437- MTD_READOOB ( inftl -> mbd . mtd , (thisEUN * inftl -> EraseSize ) +
438- blockofs , 8 , & retlen , (char * )& bci );
440+ mtd -> read_oob ( mtd , (thisEUN * inftl -> EraseSize ) +
441+ blockofs , 8 , & retlen , (char * )& bci );
439442
440443 status = bci .Status | bci .Status1 ;
441444 DEBUG (MTD_DEBUG_LEVEL3 , "INFTL: status of block %d in "
@@ -522,8 +525,8 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block)
522525 nacs = 0 ;
523526 thisEUN = inftl -> VUtable [thisVUC ];
524527 if (thisEUN != BLOCK_NIL ) {
525- MTD_READOOB ( inftl -> mbd . mtd , thisEUN * inftl -> EraseSize
526- + 8 , 8 , & retlen , (char * )& oob .u );
528+ mtd -> read_oob ( mtd , thisEUN * inftl -> EraseSize
529+ + 8 , 8 , & retlen , (char * )& oob .u );
527530 anac = oob .u .a .ANAC + 1 ;
528531 nacs = oob .u .a .NACs + 1 ;
529532 }
@@ -544,8 +547,8 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block)
544547 oob .u .a .parityPerField = parity ;
545548 oob .u .a .discarded = 0xaa ;
546549
547- MTD_WRITEOOB ( inftl -> mbd . mtd , writeEUN * inftl -> EraseSize + 8 , 8 ,
548- & retlen , (char * )& oob .u );
550+ mtd -> write_oob ( mtd , writeEUN * inftl -> EraseSize + 8 , 8 ,
551+ & retlen , (char * )& oob .u );
549552
550553 /* Also back up header... */
551554 oob .u .b .virtualUnitNo = cpu_to_le16 (thisVUC );
@@ -555,8 +558,8 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block)
555558 oob .u .b .parityPerField = parity ;
556559 oob .u .b .discarded = 0xaa ;
557560
558- MTD_WRITEOOB ( inftl -> mbd . mtd , writeEUN * inftl -> EraseSize +
559- SECTORSIZE * 4 + 8 , 8 , & retlen , (char * )& oob .u );
561+ mtd -> write_oob ( mtd , writeEUN * inftl -> EraseSize +
562+ SECTORSIZE * 4 + 8 , 8 , & retlen , (char * )& oob .u );
560563
561564 inftl -> PUtable [writeEUN ] = inftl -> VUtable [thisVUC ];
562565 inftl -> VUtable [thisVUC ] = writeEUN ;
@@ -576,6 +579,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block)
576579 */
577580static void INFTL_trydeletechain (struct INFTLrecord * inftl , unsigned thisVUC )
578581{
582+ struct mtd_info * mtd = inftl -> mbd .mtd ;
579583 unsigned char BlockUsed [MAX_SECTORS_PER_UNIT ];
580584 unsigned char BlockDeleted [MAX_SECTORS_PER_UNIT ];
581585 unsigned int thisEUN , status ;
@@ -606,9 +610,9 @@ static void INFTL_trydeletechain(struct INFTLrecord *inftl, unsigned thisVUC)
606610 if (BlockUsed [block ] || BlockDeleted [block ])
607611 continue ;
608612
609- if (MTD_READOOB ( inftl -> mbd . mtd , (thisEUN * inftl -> EraseSize )
610- + (block * SECTORSIZE ), 8 , & retlen ,
611- (char * )& bci ) < 0 )
613+ if (mtd -> read_oob ( mtd , (thisEUN * inftl -> EraseSize )
614+ + (block * SECTORSIZE ), 8 , & retlen ,
615+ (char * )& bci ) < 0 )
612616 status = SECTOR_IGNORE ;
613617 else
614618 status = bci .Status | bci .Status1 ;
@@ -697,6 +701,7 @@ static int INFTL_deleteblock(struct INFTLrecord *inftl, unsigned block)
697701{
698702 unsigned int thisEUN = inftl -> VUtable [block / (inftl -> EraseSize / SECTORSIZE )];
699703 unsigned long blockofs = (block * SECTORSIZE ) & (inftl -> EraseSize - 1 );
704+ struct mtd_info * mtd = inftl -> mbd .mtd ;
700705 unsigned int status ;
701706 int silly = MAX_LOOPS ;
702707 size_t retlen ;
@@ -706,8 +711,8 @@ static int INFTL_deleteblock(struct INFTLrecord *inftl, unsigned block)
706711 "block=%d)\n" , inftl , block );
707712
708713 while (thisEUN < inftl -> nb_blocks ) {
709- if (MTD_READOOB ( inftl -> mbd . mtd , (thisEUN * inftl -> EraseSize ) +
710- blockofs , 8 , & retlen , (char * )& bci ) < 0 )
714+ if (mtd -> read_oob ( mtd , (thisEUN * inftl -> EraseSize ) +
715+ blockofs , 8 , & retlen , (char * )& bci ) < 0 )
711716 status = SECTOR_IGNORE ;
712717 else
713718 status = bci .Status | bci .Status1 ;
@@ -741,10 +746,10 @@ static int INFTL_deleteblock(struct INFTLrecord *inftl, unsigned block)
741746 if (thisEUN != BLOCK_NIL ) {
742747 loff_t ptr = (thisEUN * inftl -> EraseSize ) + blockofs ;
743748
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 )
745750 return - EIO ;
746751 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 )
748753 return - EIO ;
749754 INFTL_trydeletechain (inftl , block / (inftl -> EraseSize / SECTORSIZE ));
750755 }
@@ -805,6 +810,7 @@ static int inftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block,
805810 struct INFTLrecord * inftl = (void * )mbd ;
806811 unsigned int thisEUN = inftl -> VUtable [block / (inftl -> EraseSize / SECTORSIZE )];
807812 unsigned long blockofs = (block * SECTORSIZE ) & (inftl -> EraseSize - 1 );
813+ struct mtd_info * mtd = inftl -> mbd .mtd ;
808814 unsigned int status ;
809815 int silly = MAX_LOOPS ;
810816 struct inftl_bci bci ;
@@ -814,8 +820,8 @@ static int inftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block,
814820 "buffer=%p)\n" , inftl , block , buffer );
815821
816822 while (thisEUN < inftl -> nb_blocks ) {
817- if (MTD_READOOB ( inftl -> mbd . mtd , (thisEUN * inftl -> EraseSize ) +
818- blockofs , 8 , & retlen , (char * )& bci ) < 0 )
823+ if (mtd -> read_oob ( mtd , (thisEUN * inftl -> EraseSize ) +
824+ blockofs , 8 , & retlen , (char * )& bci ) < 0 )
819825 status = SECTOR_IGNORE ;
820826 else
821827 status = bci .Status | bci .Status1 ;
@@ -853,8 +859,7 @@ static int inftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block,
853859 } else {
854860 size_t retlen ;
855861 loff_t ptr = (thisEUN * inftl -> EraseSize ) + blockofs ;
856- if (MTD_READ (inftl -> mbd .mtd , ptr , SECTORSIZE , & retlen ,
857- buffer ))
862+ if (mtd -> read (mtd , ptr , SECTORSIZE , & retlen , buffer ))
858863 return - EIO ;
859864 }
860865 return 0 ;
0 commit comments