diff options
author | Maxim Levitsky <maximlevitsky@gmail.com> | 2010-02-22 20:39:37 +0200 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-02-26 18:00:08 +0000 |
commit | b64d39d8b03fea88417d53715ccbebf71d4dcc9f (patch) | |
tree | 1644c3aa53bc250171d19cc9c85b2ae8ca7e0a54 /drivers/mtd/nand/nand_bbt.c | |
parent | 782ce79a45b3b850b108896fcf7da26754061c8f (diff) | |
download | op-kernel-dev-b64d39d8b03fea88417d53715ccbebf71d4dcc9f.zip op-kernel-dev-b64d39d8b03fea88417d53715ccbebf71d4dcc9f.tar.gz |
mtd: nand: make reads using MTD_OOB_RAW affect only ECC validation
This changes the behavier of MTD_OOB_RAW. It used to read both OOB and
data to the data buffer, however you would still need to specify the
dummy oob buffer.
This is only used in one place, but makes it hard to read data+oob
without ECC test, thus I removed that behavier, and fixed the user.
Now MTD_OOB_RAW behaves just like MTD_OOB_PLACE, but doesn't do ECC
validation
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand/nand_bbt.c')
-rw-r--r-- | drivers/mtd/nand/nand_bbt.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c index 55c23e5..387c45c 100644 --- a/drivers/mtd/nand/nand_bbt.c +++ b/drivers/mtd/nand/nand_bbt.c @@ -237,15 +237,33 @@ static int scan_read_raw(struct mtd_info *mtd, uint8_t *buf, loff_t offs, size_t len) { struct mtd_oob_ops ops; + int res; ops.mode = MTD_OOB_RAW; ops.ooboffs = 0; ops.ooblen = mtd->oobsize; - ops.oobbuf = buf; - ops.datbuf = buf; - ops.len = len; - return mtd->read_oob(mtd, offs, &ops); + + while (len > 0) { + if (len <= mtd->writesize) { + ops.oobbuf = buf + len; + ops.datbuf = buf; + ops.len = len; + return mtd->read_oob(mtd, offs, &ops); + } else { + ops.oobbuf = buf + mtd->writesize; + ops.datbuf = buf; + ops.len = mtd->writesize; + res = mtd->read_oob(mtd, offs, &ops); + + if (res) + return res; + } + + buf += mtd->oobsize + mtd->writesize; + len -= mtd->writesize; + } + return 0; } /* |