mtd: nand: make MTD_OOB_PLACE work correctly.

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Feb 26 13:59:02 EST 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=9aca334e854c319ccafea871006fda3814196e7b
Commit:     9aca334e854c319ccafea871006fda3814196e7b
Parent:     49ef3c6ee11e221b26caf4ac55c2702a37cca103
Author:     Maxim Levitsky <maximlevitsky at gmail.com>
AuthorDate: Mon Feb 22 20:39:35 2010 +0200
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Feb 26 17:44:51 2010 +0000

    mtd: nand: make MTD_OOB_PLACE work correctly.
    
    MTD_OOB_PLACE is supposed to read/write the raw oob data similiar to the
    MTD_OOB_RAW however due to a bug, currently it is not possible to read
    more data that is specified by the oob 'free' regions.
    
    Signed-off-by: Maxim Levitsky <maximlevitsky at gmail.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/nand_base.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 7442b3a..cada4cf 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1420,6 +1420,9 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
 	int ret = 0;
 	uint32_t readlen = ops->len;
 	uint32_t oobreadlen = ops->ooblen;
+	uint32_t max_oobsize = ops->mode == MTD_OOB_AUTO ?
+		mtd->oobavail : mtd->oobsize;
+
 	uint8_t *bufpoi, *oob, *buf;
 
 	stats = mtd->ecc_stats;
@@ -1470,10 +1473,11 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
 			buf += bytes;
 
 			if (unlikely(oob)) {
+
 				/* Raw mode does data:oob:data:oob */
 				if (ops->mode != MTD_OOB_RAW) {
 					int toread = min(oobreadlen,
-						chip->ecc.layout->oobavail);
+								max_oobsize);
 					if (toread) {
 						oob = nand_transfer_oob(chip,
 							oob, ops, toread);



More information about the linux-mtd-cvs mailing list