Loading drivers/mtd/inftlcore.c +34 −29 Original line number Diff line number Diff line Loading @@ -197,6 +197,7 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned u16 BlockMap[MAX_SECTORS_PER_UNIT]; unsigned char BlockDeleted[MAX_SECTORS_PER_UNIT]; unsigned int thisEUN, prevEUN, status; struct mtd_info *mtd = inftl->mbd.mtd; int block, silly; unsigned int targetEUN; struct inftl_oob oob; Loading Loading @@ -226,7 +227,7 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned if ((BlockMap[block] != 0xffff) || BlockDeleted[block]) continue; if (MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) if (mtd->read_oob(mtd, (thisEUN * inftl->EraseSize) + (block * SECTORSIZE), 16 , &retlen, (char *)&oob) < 0) status = SECTOR_IGNORE; Loading Loading @@ -288,13 +289,14 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned if (BlockMap[block] == BLOCK_NIL) continue; ret = MTD_READ(inftl->mbd.mtd, (inftl->EraseSize * BlockMap[block]) + (block * SECTORSIZE), SECTORSIZE, &retlen, movebuf); ret = mtd->read(mtd, (inftl->EraseSize * BlockMap[block]) + (block * SECTORSIZE), SECTORSIZE, &retlen, movebuf); if (ret < 0) { ret = MTD_READ(inftl->mbd.mtd, (inftl->EraseSize * BlockMap[block]) + (block * SECTORSIZE), SECTORSIZE, &retlen, movebuf); ret = mtd->read(mtd, (inftl->EraseSize * BlockMap[block]) + (block * SECTORSIZE), SECTORSIZE, &retlen, movebuf); if (ret != -EIO) DEBUG(MTD_DEBUG_LEVEL1, "INFTL: error went " "away on retry?\n"); Loading Loading @@ -415,6 +417,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block) unsigned int thisVUC = block / (inftl->EraseSize / SECTORSIZE); unsigned int thisEUN, writeEUN, prev_block, status; unsigned long blockofs = (block * SECTORSIZE) & (inftl->EraseSize -1); struct mtd_info *mtd = inftl->mbd.mtd; struct inftl_oob oob; struct inftl_bci bci; unsigned char anac, nacs, parity; Loading @@ -434,7 +437,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block) silly = MAX_LOOPS; while (thisEUN <= inftl->lastEUN) { MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) + mtd->read_oob(mtd, (thisEUN * inftl->EraseSize) + blockofs, 8, &retlen, (char *)&bci); status = bci.Status | bci.Status1; Loading Loading @@ -522,7 +525,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block) nacs = 0; thisEUN = inftl->VUtable[thisVUC]; if (thisEUN != BLOCK_NIL) { MTD_READOOB(inftl->mbd.mtd, thisEUN * inftl->EraseSize mtd->read_oob(mtd, thisEUN * inftl->EraseSize + 8, 8, &retlen, (char *)&oob.u); anac = oob.u.a.ANAC + 1; nacs = oob.u.a.NACs + 1; Loading @@ -544,7 +547,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block) oob.u.a.parityPerField = parity; oob.u.a.discarded = 0xaa; MTD_WRITEOOB(inftl->mbd.mtd, writeEUN * inftl->EraseSize + 8, 8, mtd->write_oob(mtd, writeEUN * inftl->EraseSize + 8, 8, &retlen, (char *)&oob.u); /* Also back up header... */ Loading @@ -555,7 +558,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block) oob.u.b.parityPerField = parity; oob.u.b.discarded = 0xaa; MTD_WRITEOOB(inftl->mbd.mtd, writeEUN * inftl->EraseSize + mtd->write_oob(mtd, writeEUN * inftl->EraseSize + SECTORSIZE * 4 + 8, 8, &retlen, (char *)&oob.u); inftl->PUtable[writeEUN] = inftl->VUtable[thisVUC]; Loading @@ -576,6 +579,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block) */ static void INFTL_trydeletechain(struct INFTLrecord *inftl, unsigned thisVUC) { struct mtd_info *mtd = inftl->mbd.mtd; unsigned char BlockUsed[MAX_SECTORS_PER_UNIT]; unsigned char BlockDeleted[MAX_SECTORS_PER_UNIT]; unsigned int thisEUN, status; Loading Loading @@ -606,7 +610,7 @@ static void INFTL_trydeletechain(struct INFTLrecord *inftl, unsigned thisVUC) if (BlockUsed[block] || BlockDeleted[block]) continue; if (MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) if (mtd->read_oob(mtd, (thisEUN * inftl->EraseSize) + (block * SECTORSIZE), 8 , &retlen, (char *)&bci) < 0) status = SECTOR_IGNORE; Loading Loading @@ -697,6 +701,7 @@ static int INFTL_deleteblock(struct INFTLrecord *inftl, unsigned block) { unsigned int thisEUN = inftl->VUtable[block / (inftl->EraseSize / SECTORSIZE)]; unsigned long blockofs = (block * SECTORSIZE) & (inftl->EraseSize - 1); struct mtd_info *mtd = inftl->mbd.mtd; unsigned int status; int silly = MAX_LOOPS; size_t retlen; Loading @@ -706,7 +711,7 @@ static int INFTL_deleteblock(struct INFTLrecord *inftl, unsigned block) "block=%d)\n", inftl, block); while (thisEUN < inftl->nb_blocks) { if (MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) + if (mtd->read_oob(mtd, (thisEUN * inftl->EraseSize) + blockofs, 8, &retlen, (char *)&bci) < 0) status = SECTOR_IGNORE; else Loading Loading @@ -741,10 +746,10 @@ static int INFTL_deleteblock(struct INFTLrecord *inftl, unsigned block) if (thisEUN != BLOCK_NIL) { loff_t ptr = (thisEUN * inftl->EraseSize) + blockofs; if (MTD_READOOB(inftl->mbd.mtd, ptr, 8, &retlen, (char *)&bci) < 0) if (mtd->read_oob(mtd, ptr, 8, &retlen, (char *)&bci) < 0) return -EIO; bci.Status = bci.Status1 = SECTOR_DELETED; if (MTD_WRITEOOB(inftl->mbd.mtd, ptr, 8, &retlen, (char *)&bci) < 0) if (mtd->write_oob(mtd, ptr, 8, &retlen, (char *)&bci) < 0) return -EIO; INFTL_trydeletechain(inftl, block / (inftl->EraseSize / SECTORSIZE)); } Loading Loading @@ -805,6 +810,7 @@ static int inftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block, struct INFTLrecord *inftl = (void *)mbd; unsigned int thisEUN = inftl->VUtable[block / (inftl->EraseSize / SECTORSIZE)]; unsigned long blockofs = (block * SECTORSIZE) & (inftl->EraseSize - 1); struct mtd_info *mtd = inftl->mbd.mtd; unsigned int status; int silly = MAX_LOOPS; struct inftl_bci bci; Loading @@ -814,7 +820,7 @@ static int inftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block, "buffer=%p)\n", inftl, block, buffer); while (thisEUN < inftl->nb_blocks) { if (MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) + if (mtd->read_oob(mtd, (thisEUN * inftl->EraseSize) + blockofs, 8, &retlen, (char *)&bci) < 0) status = SECTOR_IGNORE; else Loading Loading @@ -853,8 +859,7 @@ static int inftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block, } else { size_t retlen; loff_t ptr = (thisEUN * inftl->EraseSize) + blockofs; if (MTD_READ(inftl->mbd.mtd, ptr, SECTORSIZE, &retlen, buffer)) if (mtd->read(mtd, ptr, SECTORSIZE, &retlen, buffer)) return -EIO; } return 0; Loading drivers/mtd/inftlmount.c +24 −19 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ static int find_boot_record(struct INFTLrecord *inftl) unsigned int i, block; u8 buf[SECTORSIZE]; struct INFTLMediaHeader *mh = &inftl->MediaHdr; struct mtd_info *mtd = inftl->mbd.mtd; struct INFTLPartition *ip; size_t retlen; Loading @@ -80,7 +81,7 @@ static int find_boot_record(struct INFTLrecord *inftl) * Check for BNAND header first. Then whinge if it's found * but later checks fail. */ ret = MTD_READ(inftl->mbd.mtd, block * inftl->EraseSize, ret = mtd->read(mtd, block * inftl->EraseSize, SECTORSIZE, &retlen, buf); /* We ignore ret in case the ECC of the MediaHeader is invalid (which is apparently acceptable) */ Loading @@ -106,8 +107,9 @@ static int find_boot_record(struct INFTLrecord *inftl) } /* To be safer with BIOS, also use erase mark as discriminant */ if ((ret = MTD_READOOB(inftl->mbd.mtd, block * inftl->EraseSize + SECTORSIZE + 8, 8, &retlen, (char *)&h1) < 0)) { if ((ret = mtd->read_oob(mtd, block * inftl->EraseSize + SECTORSIZE + 8, 8, &retlen, (char *)&h1) < 0)) { printk(KERN_WARNING "INFTL: ANAND header found at " "0x%x in mtd%d, but OOB data read failed " "(err %d)\n", block * inftl->EraseSize, Loading @@ -123,7 +125,7 @@ static int find_boot_record(struct INFTLrecord *inftl) memcpy(mh, buf, sizeof(struct INFTLMediaHeader)); /* Read the spare media header at offset 4096 */ MTD_READ(inftl->mbd.mtd, block * inftl->EraseSize + 4096, mtd->read(mtd, block * inftl->EraseSize + 4096, SECTORSIZE, &retlen, buf); if (retlen != SECTORSIZE) { printk(KERN_WARNING "INFTL: Unable to read spare " Loading Loading @@ -233,7 +235,7 @@ static int find_boot_record(struct INFTLrecord *inftl) */ instr->addr = ip->Reserved0 * inftl->EraseSize; instr->len = inftl->EraseSize; MTD_ERASE(inftl->mbd.mtd, instr); mtd->erase(mtd, instr); } if ((ip->lastUnit - ip->firstUnit + 1) < ip->virtualUnits) { printk(KERN_WARNING "INFTL: Media Header " Loading Loading @@ -387,6 +389,7 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) size_t retlen; struct inftl_unittail uci; struct erase_info *instr = &inftl->instr; struct mtd_info *mtd = inftl->mbd.mtd; int physblock; DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_formatblock(inftl=%p," Loading @@ -404,8 +407,9 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) /* Erase one physical eraseblock at a time, even though the NAND api allows us to group them. This way we if we have a failure, we can mark only the failed block in the bbt. */ for (physblock = 0; physblock < inftl->EraseSize; physblock += instr->len, instr->addr += instr->len) { MTD_ERASE(inftl->mbd.mtd, instr); for (physblock = 0; physblock < inftl->EraseSize; physblock += instr->len, instr->addr += instr->len) { mtd->erase(inftl->mbd.mtd, instr); if (instr->state == MTD_ERASE_FAILED) { printk(KERN_WARNING "INFTL: error while formatting block %d\n", Loading @@ -415,8 +419,8 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) /* * Check the "freeness" of Erase Unit before updating metadata. * FixMe: is this check really necessary? Since we have check the * return code after the erase operation. * FixMe: is this check really necessary? Since we have check * the return code after the erase operation. */ if (check_free_sectors(inftl, instr->addr, instr->len, 1) != 0) goto fail; Loading @@ -429,8 +433,7 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) uci.Reserved[2] = 0; uci.Reserved[3] = 0; instr->addr = block * inftl->EraseSize + SECTORSIZE * 2; if (MTD_WRITEOOB(inftl->mbd.mtd, instr->addr + 8, 8, &retlen, (char *)&uci) < 0) if (mtd->write_oob(mtd, instr->addr + 8, 8, &retlen, (char *)&uci) < 0) goto fail; return 0; fail: Loading Loading @@ -549,6 +552,7 @@ void INFTL_dumpVUchains(struct INFTLrecord *s) int INFTL_mount(struct INFTLrecord *s) { struct mtd_info *mtd = s->mbd.mtd; unsigned int block, first_block, prev_block, last_block; unsigned int first_logical_block, logical_block, erase_mark; int chain_length, do_format_chain; Loading Loading @@ -607,10 +611,11 @@ int INFTL_mount(struct INFTLrecord *s) break; } if (MTD_READOOB(s->mbd.mtd, block * s->EraseSize + 8, if (mtd->read_oob(mtd, block * s->EraseSize + 8, 8, &retlen, (char *)&h0) < 0 || MTD_READOOB(s->mbd.mtd, block * s->EraseSize + 2 * SECTORSIZE + 8, 8, &retlen, (char *)&h1) < 0) { mtd->read_oob(mtd, block * s->EraseSize + 2 * SECTORSIZE + 8, 8, &retlen, (char *)&h1) < 0) { /* Should never happen? */ do_format_chain++; break; Loading drivers/mtd/maps/nettel.c +1 −1 Original line number Diff line number Diff line Loading @@ -190,7 +190,7 @@ int nettel_eraseconfig(void) set_current_state(TASK_INTERRUPTIBLE); add_wait_queue(&wait_q, &wait); ret = MTD_ERASE(mtd, &nettel_erase); ret = mtd->erase(mtd, &nettel_erase); if (ret) { set_current_state(TASK_RUNNING); remove_wait_queue(&wait_q, &wait); Loading drivers/mtd/mtdblock.c +7 −6 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ static int erase_write (struct mtd_info *mtd, unsigned long pos, set_current_state(TASK_INTERRUPTIBLE); add_wait_queue(&wait_q, &wait); ret = MTD_ERASE(mtd, &erase); ret = mtd->erase(mtd, &erase); if (ret) { set_current_state(TASK_RUNNING); remove_wait_queue(&wait_q, &wait); Loading @@ -88,7 +88,7 @@ static int erase_write (struct mtd_info *mtd, unsigned long pos, * Next, writhe data to flash. */ ret = MTD_WRITE (mtd, pos, len, &retlen, buf); ret = mtd->write(mtd, pos, len, &retlen, buf); if (ret) return ret; if (retlen != len) Loading Loading @@ -138,7 +138,7 @@ static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos, mtd->name, pos, len); if (!sect_size) return MTD_WRITE (mtd, pos, len, &retlen, buf); return mtd->write(mtd, pos, len, &retlen, buf); while (len > 0) { unsigned long sect_start = (pos/sect_size)*sect_size; Loading Loading @@ -170,7 +170,8 @@ static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos, mtdblk->cache_offset != sect_start) { /* fill the cache with the current sector */ mtdblk->cache_state = STATE_EMPTY; ret = MTD_READ(mtd, sect_start, sect_size, &retlen, mtdblk->cache_data); ret = mtd->read(mtd, sect_start, sect_size, &retlen, mtdblk->cache_data); if (ret) return ret; if (retlen != sect_size) Loading Loading @@ -207,7 +208,7 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos, mtd->name, pos, len); if (!sect_size) return MTD_READ (mtd, pos, len, &retlen, buf); return mtd->read(mtd, pos, len, &retlen, buf); while (len > 0) { unsigned long sect_start = (pos/sect_size)*sect_size; Loading @@ -226,7 +227,7 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos, mtdblk->cache_offset == sect_start) { memcpy (buf, mtdblk->cache_data + offset, size); } else { ret = MTD_READ (mtd, pos, size, &retlen, buf); ret = mtd->read(mtd, pos, size, &retlen, buf); if (ret) return ret; if (retlen != size) Loading drivers/mtd/mtdchar.c +2 −2 Original line number Diff line number Diff line Loading @@ -194,7 +194,7 @@ static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t ret = mtd->read_user_prot_reg(mtd, *ppos, len, &retlen, kbuf); break; default: ret = MTD_READ(mtd, *ppos, len, &retlen, kbuf); ret = mtd->read(mtd, *ppos, len, &retlen, kbuf); } /* Nand returns -EBADMSG on ecc errors, but it returns * the data. For our userspace tools it is important Loading Loading
drivers/mtd/inftlcore.c +34 −29 Original line number Diff line number Diff line Loading @@ -197,6 +197,7 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned u16 BlockMap[MAX_SECTORS_PER_UNIT]; unsigned char BlockDeleted[MAX_SECTORS_PER_UNIT]; unsigned int thisEUN, prevEUN, status; struct mtd_info *mtd = inftl->mbd.mtd; int block, silly; unsigned int targetEUN; struct inftl_oob oob; Loading Loading @@ -226,7 +227,7 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned if ((BlockMap[block] != 0xffff) || BlockDeleted[block]) continue; if (MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) if (mtd->read_oob(mtd, (thisEUN * inftl->EraseSize) + (block * SECTORSIZE), 16 , &retlen, (char *)&oob) < 0) status = SECTOR_IGNORE; Loading Loading @@ -288,13 +289,14 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned if (BlockMap[block] == BLOCK_NIL) continue; ret = MTD_READ(inftl->mbd.mtd, (inftl->EraseSize * BlockMap[block]) + (block * SECTORSIZE), SECTORSIZE, &retlen, movebuf); ret = mtd->read(mtd, (inftl->EraseSize * BlockMap[block]) + (block * SECTORSIZE), SECTORSIZE, &retlen, movebuf); if (ret < 0) { ret = MTD_READ(inftl->mbd.mtd, (inftl->EraseSize * BlockMap[block]) + (block * SECTORSIZE), SECTORSIZE, &retlen, movebuf); ret = mtd->read(mtd, (inftl->EraseSize * BlockMap[block]) + (block * SECTORSIZE), SECTORSIZE, &retlen, movebuf); if (ret != -EIO) DEBUG(MTD_DEBUG_LEVEL1, "INFTL: error went " "away on retry?\n"); Loading Loading @@ -415,6 +417,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block) unsigned int thisVUC = block / (inftl->EraseSize / SECTORSIZE); unsigned int thisEUN, writeEUN, prev_block, status; unsigned long blockofs = (block * SECTORSIZE) & (inftl->EraseSize -1); struct mtd_info *mtd = inftl->mbd.mtd; struct inftl_oob oob; struct inftl_bci bci; unsigned char anac, nacs, parity; Loading @@ -434,7 +437,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block) silly = MAX_LOOPS; while (thisEUN <= inftl->lastEUN) { MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) + mtd->read_oob(mtd, (thisEUN * inftl->EraseSize) + blockofs, 8, &retlen, (char *)&bci); status = bci.Status | bci.Status1; Loading Loading @@ -522,7 +525,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block) nacs = 0; thisEUN = inftl->VUtable[thisVUC]; if (thisEUN != BLOCK_NIL) { MTD_READOOB(inftl->mbd.mtd, thisEUN * inftl->EraseSize mtd->read_oob(mtd, thisEUN * inftl->EraseSize + 8, 8, &retlen, (char *)&oob.u); anac = oob.u.a.ANAC + 1; nacs = oob.u.a.NACs + 1; Loading @@ -544,7 +547,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block) oob.u.a.parityPerField = parity; oob.u.a.discarded = 0xaa; MTD_WRITEOOB(inftl->mbd.mtd, writeEUN * inftl->EraseSize + 8, 8, mtd->write_oob(mtd, writeEUN * inftl->EraseSize + 8, 8, &retlen, (char *)&oob.u); /* Also back up header... */ Loading @@ -555,7 +558,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block) oob.u.b.parityPerField = parity; oob.u.b.discarded = 0xaa; MTD_WRITEOOB(inftl->mbd.mtd, writeEUN * inftl->EraseSize + mtd->write_oob(mtd, writeEUN * inftl->EraseSize + SECTORSIZE * 4 + 8, 8, &retlen, (char *)&oob.u); inftl->PUtable[writeEUN] = inftl->VUtable[thisVUC]; Loading @@ -576,6 +579,7 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block) */ static void INFTL_trydeletechain(struct INFTLrecord *inftl, unsigned thisVUC) { struct mtd_info *mtd = inftl->mbd.mtd; unsigned char BlockUsed[MAX_SECTORS_PER_UNIT]; unsigned char BlockDeleted[MAX_SECTORS_PER_UNIT]; unsigned int thisEUN, status; Loading Loading @@ -606,7 +610,7 @@ static void INFTL_trydeletechain(struct INFTLrecord *inftl, unsigned thisVUC) if (BlockUsed[block] || BlockDeleted[block]) continue; if (MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) if (mtd->read_oob(mtd, (thisEUN * inftl->EraseSize) + (block * SECTORSIZE), 8 , &retlen, (char *)&bci) < 0) status = SECTOR_IGNORE; Loading Loading @@ -697,6 +701,7 @@ static int INFTL_deleteblock(struct INFTLrecord *inftl, unsigned block) { unsigned int thisEUN = inftl->VUtable[block / (inftl->EraseSize / SECTORSIZE)]; unsigned long blockofs = (block * SECTORSIZE) & (inftl->EraseSize - 1); struct mtd_info *mtd = inftl->mbd.mtd; unsigned int status; int silly = MAX_LOOPS; size_t retlen; Loading @@ -706,7 +711,7 @@ static int INFTL_deleteblock(struct INFTLrecord *inftl, unsigned block) "block=%d)\n", inftl, block); while (thisEUN < inftl->nb_blocks) { if (MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) + if (mtd->read_oob(mtd, (thisEUN * inftl->EraseSize) + blockofs, 8, &retlen, (char *)&bci) < 0) status = SECTOR_IGNORE; else Loading Loading @@ -741,10 +746,10 @@ static int INFTL_deleteblock(struct INFTLrecord *inftl, unsigned block) if (thisEUN != BLOCK_NIL) { loff_t ptr = (thisEUN * inftl->EraseSize) + blockofs; if (MTD_READOOB(inftl->mbd.mtd, ptr, 8, &retlen, (char *)&bci) < 0) if (mtd->read_oob(mtd, ptr, 8, &retlen, (char *)&bci) < 0) return -EIO; bci.Status = bci.Status1 = SECTOR_DELETED; if (MTD_WRITEOOB(inftl->mbd.mtd, ptr, 8, &retlen, (char *)&bci) < 0) if (mtd->write_oob(mtd, ptr, 8, &retlen, (char *)&bci) < 0) return -EIO; INFTL_trydeletechain(inftl, block / (inftl->EraseSize / SECTORSIZE)); } Loading Loading @@ -805,6 +810,7 @@ static int inftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block, struct INFTLrecord *inftl = (void *)mbd; unsigned int thisEUN = inftl->VUtable[block / (inftl->EraseSize / SECTORSIZE)]; unsigned long blockofs = (block * SECTORSIZE) & (inftl->EraseSize - 1); struct mtd_info *mtd = inftl->mbd.mtd; unsigned int status; int silly = MAX_LOOPS; struct inftl_bci bci; Loading @@ -814,7 +820,7 @@ static int inftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block, "buffer=%p)\n", inftl, block, buffer); while (thisEUN < inftl->nb_blocks) { if (MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) + if (mtd->read_oob(mtd, (thisEUN * inftl->EraseSize) + blockofs, 8, &retlen, (char *)&bci) < 0) status = SECTOR_IGNORE; else Loading Loading @@ -853,8 +859,7 @@ static int inftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block, } else { size_t retlen; loff_t ptr = (thisEUN * inftl->EraseSize) + blockofs; if (MTD_READ(inftl->mbd.mtd, ptr, SECTORSIZE, &retlen, buffer)) if (mtd->read(mtd, ptr, SECTORSIZE, &retlen, buffer)) return -EIO; } return 0; Loading
drivers/mtd/inftlmount.c +24 −19 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ static int find_boot_record(struct INFTLrecord *inftl) unsigned int i, block; u8 buf[SECTORSIZE]; struct INFTLMediaHeader *mh = &inftl->MediaHdr; struct mtd_info *mtd = inftl->mbd.mtd; struct INFTLPartition *ip; size_t retlen; Loading @@ -80,7 +81,7 @@ static int find_boot_record(struct INFTLrecord *inftl) * Check for BNAND header first. Then whinge if it's found * but later checks fail. */ ret = MTD_READ(inftl->mbd.mtd, block * inftl->EraseSize, ret = mtd->read(mtd, block * inftl->EraseSize, SECTORSIZE, &retlen, buf); /* We ignore ret in case the ECC of the MediaHeader is invalid (which is apparently acceptable) */ Loading @@ -106,8 +107,9 @@ static int find_boot_record(struct INFTLrecord *inftl) } /* To be safer with BIOS, also use erase mark as discriminant */ if ((ret = MTD_READOOB(inftl->mbd.mtd, block * inftl->EraseSize + SECTORSIZE + 8, 8, &retlen, (char *)&h1) < 0)) { if ((ret = mtd->read_oob(mtd, block * inftl->EraseSize + SECTORSIZE + 8, 8, &retlen, (char *)&h1) < 0)) { printk(KERN_WARNING "INFTL: ANAND header found at " "0x%x in mtd%d, but OOB data read failed " "(err %d)\n", block * inftl->EraseSize, Loading @@ -123,7 +125,7 @@ static int find_boot_record(struct INFTLrecord *inftl) memcpy(mh, buf, sizeof(struct INFTLMediaHeader)); /* Read the spare media header at offset 4096 */ MTD_READ(inftl->mbd.mtd, block * inftl->EraseSize + 4096, mtd->read(mtd, block * inftl->EraseSize + 4096, SECTORSIZE, &retlen, buf); if (retlen != SECTORSIZE) { printk(KERN_WARNING "INFTL: Unable to read spare " Loading Loading @@ -233,7 +235,7 @@ static int find_boot_record(struct INFTLrecord *inftl) */ instr->addr = ip->Reserved0 * inftl->EraseSize; instr->len = inftl->EraseSize; MTD_ERASE(inftl->mbd.mtd, instr); mtd->erase(mtd, instr); } if ((ip->lastUnit - ip->firstUnit + 1) < ip->virtualUnits) { printk(KERN_WARNING "INFTL: Media Header " Loading Loading @@ -387,6 +389,7 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) size_t retlen; struct inftl_unittail uci; struct erase_info *instr = &inftl->instr; struct mtd_info *mtd = inftl->mbd.mtd; int physblock; DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_formatblock(inftl=%p," Loading @@ -404,8 +407,9 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) /* Erase one physical eraseblock at a time, even though the NAND api allows us to group them. This way we if we have a failure, we can mark only the failed block in the bbt. */ for (physblock = 0; physblock < inftl->EraseSize; physblock += instr->len, instr->addr += instr->len) { MTD_ERASE(inftl->mbd.mtd, instr); for (physblock = 0; physblock < inftl->EraseSize; physblock += instr->len, instr->addr += instr->len) { mtd->erase(inftl->mbd.mtd, instr); if (instr->state == MTD_ERASE_FAILED) { printk(KERN_WARNING "INFTL: error while formatting block %d\n", Loading @@ -415,8 +419,8 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) /* * Check the "freeness" of Erase Unit before updating metadata. * FixMe: is this check really necessary? Since we have check the * return code after the erase operation. * FixMe: is this check really necessary? Since we have check * the return code after the erase operation. */ if (check_free_sectors(inftl, instr->addr, instr->len, 1) != 0) goto fail; Loading @@ -429,8 +433,7 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) uci.Reserved[2] = 0; uci.Reserved[3] = 0; instr->addr = block * inftl->EraseSize + SECTORSIZE * 2; if (MTD_WRITEOOB(inftl->mbd.mtd, instr->addr + 8, 8, &retlen, (char *)&uci) < 0) if (mtd->write_oob(mtd, instr->addr + 8, 8, &retlen, (char *)&uci) < 0) goto fail; return 0; fail: Loading Loading @@ -549,6 +552,7 @@ void INFTL_dumpVUchains(struct INFTLrecord *s) int INFTL_mount(struct INFTLrecord *s) { struct mtd_info *mtd = s->mbd.mtd; unsigned int block, first_block, prev_block, last_block; unsigned int first_logical_block, logical_block, erase_mark; int chain_length, do_format_chain; Loading Loading @@ -607,10 +611,11 @@ int INFTL_mount(struct INFTLrecord *s) break; } if (MTD_READOOB(s->mbd.mtd, block * s->EraseSize + 8, if (mtd->read_oob(mtd, block * s->EraseSize + 8, 8, &retlen, (char *)&h0) < 0 || MTD_READOOB(s->mbd.mtd, block * s->EraseSize + 2 * SECTORSIZE + 8, 8, &retlen, (char *)&h1) < 0) { mtd->read_oob(mtd, block * s->EraseSize + 2 * SECTORSIZE + 8, 8, &retlen, (char *)&h1) < 0) { /* Should never happen? */ do_format_chain++; break; Loading
drivers/mtd/maps/nettel.c +1 −1 Original line number Diff line number Diff line Loading @@ -190,7 +190,7 @@ int nettel_eraseconfig(void) set_current_state(TASK_INTERRUPTIBLE); add_wait_queue(&wait_q, &wait); ret = MTD_ERASE(mtd, &nettel_erase); ret = mtd->erase(mtd, &nettel_erase); if (ret) { set_current_state(TASK_RUNNING); remove_wait_queue(&wait_q, &wait); Loading
drivers/mtd/mtdblock.c +7 −6 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ static int erase_write (struct mtd_info *mtd, unsigned long pos, set_current_state(TASK_INTERRUPTIBLE); add_wait_queue(&wait_q, &wait); ret = MTD_ERASE(mtd, &erase); ret = mtd->erase(mtd, &erase); if (ret) { set_current_state(TASK_RUNNING); remove_wait_queue(&wait_q, &wait); Loading @@ -88,7 +88,7 @@ static int erase_write (struct mtd_info *mtd, unsigned long pos, * Next, writhe data to flash. */ ret = MTD_WRITE (mtd, pos, len, &retlen, buf); ret = mtd->write(mtd, pos, len, &retlen, buf); if (ret) return ret; if (retlen != len) Loading Loading @@ -138,7 +138,7 @@ static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos, mtd->name, pos, len); if (!sect_size) return MTD_WRITE (mtd, pos, len, &retlen, buf); return mtd->write(mtd, pos, len, &retlen, buf); while (len > 0) { unsigned long sect_start = (pos/sect_size)*sect_size; Loading Loading @@ -170,7 +170,8 @@ static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos, mtdblk->cache_offset != sect_start) { /* fill the cache with the current sector */ mtdblk->cache_state = STATE_EMPTY; ret = MTD_READ(mtd, sect_start, sect_size, &retlen, mtdblk->cache_data); ret = mtd->read(mtd, sect_start, sect_size, &retlen, mtdblk->cache_data); if (ret) return ret; if (retlen != sect_size) Loading Loading @@ -207,7 +208,7 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos, mtd->name, pos, len); if (!sect_size) return MTD_READ (mtd, pos, len, &retlen, buf); return mtd->read(mtd, pos, len, &retlen, buf); while (len > 0) { unsigned long sect_start = (pos/sect_size)*sect_size; Loading @@ -226,7 +227,7 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos, mtdblk->cache_offset == sect_start) { memcpy (buf, mtdblk->cache_data + offset, size); } else { ret = MTD_READ (mtd, pos, size, &retlen, buf); ret = mtd->read(mtd, pos, size, &retlen, buf); if (ret) return ret; if (retlen != size) Loading
drivers/mtd/mtdchar.c +2 −2 Original line number Diff line number Diff line Loading @@ -194,7 +194,7 @@ static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t ret = mtd->read_user_prot_reg(mtd, *ppos, len, &retlen, kbuf); break; default: ret = MTD_READ(mtd, *ppos, len, &retlen, kbuf); ret = mtd->read(mtd, *ppos, len, &retlen, kbuf); } /* Nand returns -EBADMSG on ecc errors, but it returns * the data. For our userspace tools it is important Loading