diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2005-04-01 02:21:48 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-05-23 07:07:14 -0400 |
commit | 998cf6403cdaac74211c619772bea027274ffc42 (patch) | |
tree | 393fc73e9a3039c3f1cb1b54b867230a86f8be78 | |
parent | 963a6fb0a0d336d0513083b7e4b5c3ff9d6d2061 (diff) |
[MTD] NAND: Fix oob available calculation
Use oobfree to calculate the number of oob bytes available for fs usage
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | 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 index 422c465f311d..aea87f05389e 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -59,7 +59,7 @@ | |||
59 | * The AG-AND chips have nice features for speed improvement, | 59 | * The AG-AND chips have nice features for speed improvement, |
60 | * which are not supported yet. Read / program 4 pages in one go. | 60 | * which are not supported yet. Read / program 4 pages in one go. |
61 | * | 61 | * |
62 | * $Id: nand_base.c,v 1.137 2005/03/24 14:33:22 dedekind Exp $ | 62 | * $Id: nand_base.c,v 1.138 2005/04/01 07:21:44 gleixner Exp $ |
63 | * | 63 | * |
64 | * This program is free software; you can redistribute it and/or modify | 64 | * This program is free software; you can redistribute it and/or modify |
65 | * it under the terms of the GNU General Public License version 2 as | 65 | * 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 maxchips) | |||
2512 | 2512 | ||
2513 | /* The number of bytes available for the filesystem to place fs dependend | 2513 | /* The number of bytes available for the filesystem to place fs dependend |
2514 | * oob data */ | 2514 | * oob data */ |
2515 | if (this->options & NAND_BUSWIDTH_16) { | 2515 | mtd->oobavail = 0; |
2516 | mtd->oobavail = mtd->oobsize - (this->autooob->eccbytes + 2); | 2516 | for (i = 0; this->autooob->oobfree[i][1]; i++) |
2517 | if (this->autooob->eccbytes & 0x01) | 2517 | mtd->oobavail += this->autooob->oobfree[i][1]; |
2518 | mtd->oobavail--; | ||
2519 | } else | ||
2520 | mtd->oobavail = mtd->oobsize - (this->autooob->eccbytes + 1); | ||
2521 | 2518 | ||
2522 | /* | 2519 | /* |
2523 | * check ECC mode, default to software | 2520 | * check ECC mode, default to software |