tree 393fc73e9a3039c3f1cb1b54b867230a86f8be78
parent 963a6fb0a0d336d0513083b7e4b5c3ff9d6d2061
author Thomas Gleixner <[EMAIL PROTECTED]> Fri, 01 Apr 2005 08:21:48 +0100
committer Thomas Gleixner <[EMAIL PROTECTED]> Mon, 23 May 2005 13:07:14 +0200

[MTD] NAND: Fix oob available calculation

Use oobfree to calculate the number of oob bytes available for fs usage

Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>

 drivers/mtd/nand/nand_base.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -59,7 +59,7 @@
  *     The AG-AND chips have nice features for speed improvement,
  *     which are not supported yet. Read / program 4 pages in one go.
  *
- * $Id: nand_base.c,v 1.137 2005/03/24 14:33:22 dedekind Exp $
+ * $Id: nand_base.c,v 1.138 2005/04/01 07:21:44 gleixner Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -2512,12 +2512,9 @@ int nand_scan (struct mtd_info *mtd, int
        
        /* The number of bytes available for the filesystem to place fs 
dependend
         * oob data */
-       if (this->options & NAND_BUSWIDTH_16) {
-               mtd->oobavail = mtd->oobsize - (this->autooob->eccbytes + 2);
-               if (this->autooob->eccbytes & 0x01)
-                       mtd->oobavail--;
-       } else
-               mtd->oobavail = mtd->oobsize - (this->autooob->eccbytes + 1);
+       mtd->oobavail = 0;
+       for (i = 0; this->autooob->oobfree[i][1]; i++)
+               mtd->oobavail += this->autooob->oobfree[i][1];
 
        /* 
         * check ECC mode, default to software
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to