X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=yaffs_mtdif.c;h=5d1777ec6387f39d6b49a0034655f0aea707caf6;hb=be543b3cc9f7075461ad0a830fd1aa54711eab95;hp=2dfc7058c619307cd92aa79f0c68843e8f2f9b91;hpb=37fd9ec3587b5c4d497a7682522a9adfab682e51;p=yaffs2.git diff --git a/yaffs_mtdif.c b/yaffs_mtdif.c index 2dfc705..5d1777e 100644 --- a/yaffs_mtdif.c +++ b/yaffs_mtdif.c @@ -13,33 +13,33 @@ * */ -const char *yaffs_mtdif_c_version = "$Id: yaffs_mtdif.c,v 1.1 2004-12-17 04:39:04 charles Exp $"; - -#ifdef CONFIG_YAFFS_MTD_ENABLED +const char *yaffs_mtdif_c_version = "$Id: yaffs_mtdif.c,v 1.8 2005-08-02 19:17:55 luc Exp $"; #include "yportenv.h" +#ifdef CONFIG_YAFFS_YAFFS1 + #include "yaffs_mtdif.h" #include "linux/mtd/mtd.h" #include "linux/types.h" #include "linux/time.h" - -#ifndef CONFIG_YAFFS_USE_OLD_MTD #include "linux/mtd/nand.h" -#endif -struct nand_oobinfo yaffs_oobinfo = { - useecc: 1, - eccpos: {8, 9, 10, 13, 14, 15} +static struct nand_oobinfo yaffs_oobinfo = { + .useecc = 1, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8)) + .eccbytes = 6, +#endif + .eccpos = {8, 9, 10, 13, 14, 15} }; -struct nand_oobinfo yaffs_noeccinfo = { - useecc: 0, +static struct nand_oobinfo yaffs_noeccinfo = { + .useecc = 0, }; -int nandmtd_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, yaffs_Spare *spare) +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; @@ -49,7 +49,6 @@ int nandmtd_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, __u8 *spareAsBytes = (__u8 *)spare; -#ifndef CONFIG_YAFFS_USE_OLD_MTD if(data && spare) { if(dev->useNANDECC) @@ -59,14 +58,11 @@ int nandmtd_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, } 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; @@ -84,7 +80,6 @@ int nandmtd_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaf __u8 *spareAsBytes = (__u8 *)spare; -#ifndef CONFIG_YAFFS_USE_OLD_MTD if(data && spare) { if(dev->useNANDECC) @@ -99,14 +94,11 @@ int nandmtd_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaf } else { -#endif if(data) retval = mtd->read(mtd,addr,dev->nBytesPerChunk,&dummy,data); if(spare) retval = mtd->read_oob(mtd,addr,YAFFS_BYTES_PER_SPARE,&dummy,spareAsBytes); -#ifndef CONFIG_YAFFS_USE_OLD_MTD } -#endif if (retval == 0) return YAFFS_OK; @@ -159,5 +151,5 @@ int nandmtd_InitialiseNAND(yaffs_Device *dev) return YAFFS_OK; } -#endif // CONFIG_YAFFS_MTD_ENABLED +#endif // CONFIG_YAFFS_YAFFS1