diff options
author | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-27 14:36:12 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-29 09:06:49 -0400 |
commit | ff268fb8791cf18df536113355d7184007c269d9 (patch) | |
tree | 3a7d9fc72b28f5a0f11a2f8b08174b1bee6ea20d /drivers/mtd | |
parent | 8be834f76291fdcc0614cb84926c6910b9f2ecbc (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>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/mtdchar.c | 10 | ||||
-rw-r--r-- | drivers/mtd/mtdconcat.c | 4 | ||||
-rw-r--r-- | drivers/mtd/mtdpart.c | 4 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 10 | ||||
-rw-r--r-- | drivers/mtd/onenand/onenand_base.c | 2 |
5 files changed, 6 insertions, 24 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; |