diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 7a7df851c99339062cce3570cab6833e03465690..608f7af679cbee138fea143cf483b1d9660aa986 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -512,16 +512,10 @@ static int mtd_ioctl(struct inode *inode, struct file *file, break; } - case MEMSETOOBSEL: - { - if (copy_from_user(&mtd->oobinfo, argp, sizeof(struct nand_oobinfo))) - return -EFAULT; - break; - } - case MEMGETOOBSEL: { - if (copy_to_user(argp, &(mtd->oobinfo), sizeof(struct nand_oobinfo))) + if (copy_to_user(argp, mtd->oobinfo, + sizeof(struct nand_oobinfo))) return -EFAULT; break; } diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 6d52137988faf3e5fe29e628294044a145d37a00..699fce7770de4de356be710bd16e5d22c91571f5 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -766,9 +766,7 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c } - if(concat->mtd.type == MTD_NANDFLASH) - memcpy(&concat->mtd.oobinfo, &subdev[0]->oobinfo, - sizeof(struct nand_oobinfo)); + concat->mtd.oobinfo = subdev[0]->oobinfo; concat->num_subdev = num_devs; concat->mtd.name = name; diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index a93550ce797806d9bee045f1cbd708f3abbe66e7..b6b218952d49b24ac76c660eb2f1c80ce74c09f7 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -316,7 +316,6 @@ int add_mtd_partitions(struct mtd_info *master, slave->mtd.size = parts[i].size; slave->mtd.writesize = master->writesize; slave->mtd.oobsize = master->oobsize; - slave->mtd.oobavail = master->oobavail; slave->mtd.ecctype = master->ecctype; slave->mtd.eccsize = master->eccsize; @@ -435,8 +434,7 @@ int add_mtd_partitions(struct mtd_info *master, parts[i].name); } - /* copy oobinfo from master */ - memcpy(&slave->mtd.oobinfo, &master->oobinfo, sizeof(slave->mtd.oobinfo)); + slave->mtd.oobinfo = master->oobinfo; if(parts[i].mtdp) { /* store the object pointer (caller may or may not register it */ diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 023224dd12eb56c7f01b054e9bd545aea3c653a0..20f79fec73b5aa1dae88adee771ee599d7e8c0c8 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -2142,14 +2142,6 @@ int nand_scan(struct mtd_info *mtd, int maxchips) } } - /* - * The number of bytes available for the filesystem to place fs - * dependend oob data - */ - mtd->oobavail = 0; - for (i = 0; chip->autooob->oobfree[i][1]; i++) - mtd->oobavail += chip->autooob->oobfree[i][1]; - /* * check ECC mode, default to software if 3byte/512byte hardware ECC is * selected and we have 256 byte pagesize fallback to software ECC @@ -2245,7 +2237,7 @@ int nand_scan(struct mtd_info *mtd, int maxchips) mtd->block_markbad = nand_block_markbad; /* and make the autooob the default one */ - memcpy(&mtd->oobinfo, chip->autooob, sizeof(mtd->oobinfo)); + mtd->oobinfo = chip->autooob; /* Check, if we should skip the bad block table scan */ if (chip->options & NAND_SKIP_BBTSCAN) diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 7a2419186ff44b25cb65e422d3e9ffcaa4f17254..b24bfa6e202c59a53c5e7cfba5b94e7fc3cf74a1 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -1762,7 +1762,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) break; } - memcpy(&mtd->oobinfo, this->autooob, sizeof(mtd->oobinfo)); + mtd->oobinfo = this->autooob; /* Fill in remaining MTD driver data */ mtd->type = MTD_NANDFLASH; diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c index 717fa2f52ac20e64d8c19c6b233bbdc188a939a0..dc275cedfe4a6d5b92c2ffb855ef1ed4778c39d7 100644 --- a/fs/jffs2/wbuf.c +++ b/fs/jffs2/wbuf.c @@ -1151,7 +1151,7 @@ static struct nand_oobinfo jffs2_oobinfo_docecc = { static int jffs2_nand_set_oobinfo(struct jffs2_sb_info *c) { - struct nand_oobinfo *oinfo = &c->mtd->oobinfo; + struct nand_oobinfo *oinfo = c->mtd->oobinfo; /* Do this only, if we have an oob buffer */ if (!c->mtd->oobsize) diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 41a984dcb1397b80277895f33d7d2d2c137cac05..8429da51bb093f963180f7fe6aa4b3d9b070b9d8 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -101,9 +101,8 @@ struct mtd_info { char *name; int index; - // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO) - struct nand_oobinfo oobinfo; - u_int32_t oobavail; // Number of bytes in OOB area available for fs + /* oobinfo structure pointer - read only ! */ + struct nand_oobinfo *oobinfo; /* Data for variable erase regions. If numeraseregions is zero, * it means that the whole device has erasesize as given above.