]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
[MTD] [NAND] make oobavail public
authorVitaly Wool <vwool@ru.mvista.com>
Tue, 6 Mar 2007 13:56:34 +0000 (16:56 +0300)
committerDavid Woodhouse <dwmw2@infradead.org>
Thu, 8 Mar 2007 09:17:43 +0000 (09:17 +0000)
During the MTD rework the oobavail parameter of mtd_info structure has become
private. This is not quite correct in terms of integrity and logic. If we have
means to write to OOB area, then we'd like to know upfront how many bytes out
of OOB are spare per page to be able to adapt to specific cases.
The patch inlined adds the public oobavail parameter.

Signed-off-by: Vitaly Wool <vwool@ru.mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
drivers/mtd/mtdconcat.c
drivers/mtd/mtdpart.c
drivers/mtd/nand/nand_base.c
drivers/mtd/onenand/onenand_base.c
include/linux/mtd/mtd.h

index 880580c44e0134186d9a3df3fd1b81731359aa2b..41844ea02462486a3e3b4eedb978debbc6f7eb62 100644 (file)
@@ -727,6 +727,7 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[],       /* subdevices to c
        concat->mtd.erasesize = subdev[0]->erasesize;
        concat->mtd.writesize = subdev[0]->writesize;
        concat->mtd.oobsize = subdev[0]->oobsize;
+       concat->mtd.oobavail = subdev[0]->oobavail;
        if (subdev[0]->writev)
                concat->mtd.writev = concat_writev;
        if (subdev[0]->read_oob)
index 633def3fb0875daf3a38bda7dea4cfb5d8adee77..01e4afff42b04c758907ad407296c81783030f76 100644 (file)
@@ -338,6 +338,7 @@ 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.subpage_sft = master->subpage_sft;
 
                slave->mtd.name = parts[i].name;
index acaf97bc80d18f89696987db2c0370fd8cac0b76..6af37b8cff65a039d7216203e2b5b9b7750d2bf1 100644 (file)
@@ -2524,6 +2524,7 @@ int nand_scan_tail(struct mtd_info *mtd)
        for (i = 0; chip->ecc.layout->oobfree[i].length; i++)
                chip->ecc.layout->oobavail +=
                        chip->ecc.layout->oobfree[i].length;
+       mtd->oobavail = chip->ecc.layout->oobavail;
 
        /*
         * Set the number of read / write steps for one page depending on ECC
index 7f1cb6e5dccb5b8463554cbf48e5227b66b1597d..621c3f8ec27b85d7641dffbce3ec537d6825bd71 100644 (file)
@@ -2367,6 +2367,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
        for (i = 0; this->ecclayout->oobfree[i].length; i++)
                this->ecclayout->oobavail +=
                        this->ecclayout->oobfree[i].length;
+       mtd->oobavail = this->ecclayout->oobavail;
 
        mtd->ecclayout = this->ecclayout;
 
index 6a8570be331bbdb3deb587983953485427901ef5..3d956c3abb310d06867abd729f8aacd0433be00b 100644 (file)
@@ -121,6 +121,7 @@ struct mtd_info {
        u_int32_t writesize;
 
        u_int32_t oobsize;   // Amount of OOB data per block (e.g. 16)
+       u_int32_t oobavail;  // Available OOB bytes per block
 
        // Kernel-only stuff starts here.
        char *name;