aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-27 14:36:12 -0400
committerThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-29 09:06:49 -0400
commitff268fb8791cf18df536113355d7184007c269d9 (patch)
tree3a7d9fc72b28f5a0f11a2f8b08174b1bee6ea20d
parent8be834f76291fdcc0614cb84926c6910b9f2ecbc (diff)
[MTD] NAND Consolidate oobinfo handling
The info structure for out of band data was copied into the mtd structure. Make it a pointer and remove the ability to set it from userspace. The position of ecc bytes is defined by the hardware and should not be changed by software. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--drivers/mtd/mtdchar.c10
-rw-r--r--drivers/mtd/mtdconcat.c4
-rw-r--r--drivers/mtd/mtdpart.c4
-rw-r--r--drivers/mtd/nand/nand_base.c10
-rw-r--r--drivers/mtd/onenand/onenand_base.c2
-rw-r--r--fs/jffs2/wbuf.c2
-rw-r--r--include/linux/mtd/mtd.h5
7 files changed, 9 insertions, 28 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 7a7df851c993..608f7af679cb 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,
512 break; 512 break;
513 } 513 }
514 514
515 case MEMSETOOBSEL:
516 {
517 if (copy_from_user(&mtd->oobinfo, argp, sizeof(struct nand_oobinfo)))
518 return -EFAULT;
519 break;
520 }
521
522 case MEMGETOOBSEL: 515 case MEMGETOOBSEL:
523 { 516 {
524 if (copy_to_user(argp, &(mtd->oobinfo), sizeof(struct nand_oobinfo))) 517 if (copy_to_user(argp, mtd->oobinfo,
518 sizeof(struct nand_oobinfo)))
525 return -EFAULT; 519 return -EFAULT;
526 break; 520 break;
527 } 521 }
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index 6d52137988fa..699fce7770de 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
766 766
767 } 767 }
768 768
769 if(concat->mtd.type == MTD_NANDFLASH) 769 concat->mtd.oobinfo = subdev[0]->oobinfo;
770 memcpy(&concat->mtd.oobinfo, &subdev[0]->oobinfo,
771 sizeof(struct nand_oobinfo));
772 770
773 concat->num_subdev = num_devs; 771 concat->num_subdev = num_devs;
774 concat->mtd.name = name; 772 concat->mtd.name = name;
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index a93550ce7978..b6b218952d49 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -316,7 +316,6 @@ int add_mtd_partitions(struct mtd_info *master,
316 slave->mtd.size = parts[i].size; 316 slave->mtd.size = parts[i].size;
317 slave->mtd.writesize = master->writesize; 317 slave->mtd.writesize = master->writesize;
318 slave->mtd.oobsize = master->oobsize; 318 slave->mtd.oobsize = master->oobsize;
319 slave->mtd.oobavail = master->oobavail;
320 slave->mtd.ecctype = master->ecctype; 319 slave->mtd.ecctype = master->ecctype;
321 slave->mtd.eccsize = master->eccsize; 320 slave->mtd.eccsize = master->eccsize;
322 321
@@ -435,8 +434,7 @@ int add_mtd_partitions(struct mtd_info *master,
435 parts[i].name); 434 parts[i].name);
436 } 435 }
437 436
438 /* copy oobinfo from master */ 437 slave->mtd.oobinfo = master->oobinfo;
439 memcpy(&slave->mtd.oobinfo, &master->oobinfo, sizeof(slave->mtd.oobinfo));
440 438
441 if(parts[i].mtdp) 439 if(parts[i].mtdp)
442 { /* store the object pointer (caller may or may not register it */ 440 { /* 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 023224dd12eb..20f79fec73b5 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2143,14 +2143,6 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
2143 } 2143 }
2144 2144
2145 /* 2145 /*
2146 * The number of bytes available for the filesystem to place fs
2147 * dependend oob data
2148 */
2149 mtd->oobavail = 0;
2150 for (i = 0; chip->autooob->oobfree[i][1]; i++)
2151 mtd->oobavail += chip->autooob->oobfree[i][1];
2152
2153 /*
2154 * check ECC mode, default to software if 3byte/512byte hardware ECC is 2146 * check ECC mode, default to software if 3byte/512byte hardware ECC is
2155 * selected and we have 256 byte pagesize fallback to software ECC 2147 * selected and we have 256 byte pagesize fallback to software ECC
2156 */ 2148 */
@@ -2245,7 +2237,7 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
2245 mtd->block_markbad = nand_block_markbad; 2237 mtd->block_markbad = nand_block_markbad;
2246 2238
2247 /* and make the autooob the default one */ 2239 /* and make the autooob the default one */
2248 memcpy(&mtd->oobinfo, chip->autooob, sizeof(mtd->oobinfo)); 2240 mtd->oobinfo = chip->autooob;
2249 2241
2250 /* Check, if we should skip the bad block table scan */ 2242 /* Check, if we should skip the bad block table scan */
2251 if (chip->options & NAND_SKIP_BBTSCAN) 2243 if (chip->options & NAND_SKIP_BBTSCAN)
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 7a2419186ff4..b24bfa6e202c 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)
1762 break; 1762 break;
1763 } 1763 }
1764 1764
1765 memcpy(&mtd->oobinfo, this->autooob, sizeof(mtd->oobinfo)); 1765 mtd->oobinfo = this->autooob;
1766 1766
1767 /* Fill in remaining MTD driver data */ 1767 /* Fill in remaining MTD driver data */
1768 mtd->type = MTD_NANDFLASH; 1768 mtd->type = MTD_NANDFLASH;
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index 717fa2f52ac2..dc275cedfe4a 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -1151,7 +1151,7 @@ static struct nand_oobinfo jffs2_oobinfo_docecc = {
1151 1151
1152static int jffs2_nand_set_oobinfo(struct jffs2_sb_info *c) 1152static int jffs2_nand_set_oobinfo(struct jffs2_sb_info *c)
1153{ 1153{
1154 struct nand_oobinfo *oinfo = &c->mtd->oobinfo; 1154 struct nand_oobinfo *oinfo = c->mtd->oobinfo;
1155 1155
1156 /* Do this only, if we have an oob buffer */ 1156 /* Do this only, if we have an oob buffer */
1157 if (!c->mtd->oobsize) 1157 if (!c->mtd->oobsize)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 41a984dcb139..8429da51bb09 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -101,9 +101,8 @@ struct mtd_info {
101 char *name; 101 char *name;
102 int index; 102 int index;
103 103
104 // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO) 104 /* oobinfo structure pointer - read only ! */
105 struct nand_oobinfo oobinfo; 105 struct nand_oobinfo *oobinfo;
106 u_int32_t oobavail; // Number of bytes in OOB area available for fs
107 106
108 /* Data for variable erase regions. If numeraseregions is zero, 107 /* Data for variable erase regions. If numeraseregions is zero,
109 * it means that the whole device has erasesize as given above. 108 * it means that the whole device has erasesize as given above.