-#endif
-
-struct nand_oobinfo yaffs_oobinfo = {
- useecc: 1,
- eccpos: {8, 9, 10, 13, 14, 15}
-};
-
-struct nand_oobinfo yaffs_noeccinfo = {
- useecc: 0,
-};
-
-
-int nandmtd_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_Spare *spare)
-{
- struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
- size_t dummy;
- int retval = 0;
-
- loff_t addr = ((loff_t)chunkInNAND) * dev->nBytesPerChunk;
-
- __u8 *spareAsBytes = (__u8 *)spare;
-
-#ifndef CONFIG_YAFFS_USE_OLD_MTD
- if(data && spare)
- {
- if(dev->useNANDECC)
- mtd->write_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,&yaffs_oobinfo);
- else
- mtd->write_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,&yaffs_noeccinfo);
- }
- else
- {
-#endif
- if(data)
- retval = mtd->write(mtd,addr,dev->nBytesPerChunk,&dummy,data);
- if(spare)
- retval = mtd->write_oob(mtd,addr,YAFFS_BYTES_PER_SPARE,&dummy,spareAsBytes);
-#ifndef CONFIG_YAFFS_USE_OLD_MTD
- }
-#endif
-
- if (retval == 0)
- return YAFFS_OK;
- else
- return YAFFS_FAIL;
-}