diff options
author | Vitaly Wool <vwool@ru.mvista.com> | 2006-11-03 10:20:38 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-11-28 17:39:03 -0500 |
commit | 7014568bad55c20b7ee4f439d78c9e875912d51f (patch) | |
tree | 1b558ef8d77d31925cc396ed69d8f785615cf09f /drivers/mtd/nand/nand_bbt.c | |
parent | 191876729901d0c8dab8a331f9a1e4b73a56457b (diff) |
[MTD] [NAND] remove len/ooblen confusion.
As was discussed between Ricard Wanderlöf, David Woodhouse, Artem
Bityutskiy and me, the current API for reading/writing OOB is confusing.
The thing that introduces confusion is the need to specify ops.len
together with ops.ooblen for reads/writes that concern only OOB not data
area. So, ops.len is overloaded: when ops.datbuf != NULL it serves to
specify the length of the data read, and when ops.datbuf == NULL, it
serves to specify the full OOB read length.
The patch inlined below is the slightly updated version of the previous
patch serving the same purpose, but with the new Artem's comments taken
into account.
Artem, BTW, thanks a lot for your valuable input!
Signed-off-by: Vitaly Wool <vwool@ru.mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/nand/nand_bbt.c')
-rw-r--r-- | drivers/mtd/nand/nand_bbt.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c index 9402653eb09b..4e74fe9af29e 100644 --- a/drivers/mtd/nand/nand_bbt.c +++ b/drivers/mtd/nand/nand_bbt.c | |||
@@ -333,7 +333,6 @@ static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd, | |||
333 | struct mtd_oob_ops ops; | 333 | struct mtd_oob_ops ops; |
334 | int j, ret; | 334 | int j, ret; |
335 | 335 | ||
336 | ops.len = mtd->oobsize; | ||
337 | ops.ooblen = mtd->oobsize; | 336 | ops.ooblen = mtd->oobsize; |
338 | ops.oobbuf = buf; | 337 | ops.oobbuf = buf; |
339 | ops.ooboffs = 0; | 338 | ops.ooboffs = 0; |
@@ -676,10 +675,10 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
676 | "bad block table\n"); | 675 | "bad block table\n"); |
677 | } | 676 | } |
678 | /* Read oob data */ | 677 | /* Read oob data */ |
679 | ops.len = (len >> this->page_shift) * mtd->oobsize; | 678 | ops.ooblen = (len >> this->page_shift) * mtd->oobsize; |
680 | ops.oobbuf = &buf[len]; | 679 | ops.oobbuf = &buf[len]; |
681 | res = mtd->read_oob(mtd, to + mtd->writesize, &ops); | 680 | res = mtd->read_oob(mtd, to + mtd->writesize, &ops); |
682 | if (res < 0 || ops.retlen != ops.len) | 681 | if (res < 0 || ops.oobretlen != ops.ooblen) |
683 | goto outerr; | 682 | goto outerr; |
684 | 683 | ||
685 | /* Calc the byte offset in the buffer */ | 684 | /* Calc the byte offset in the buffer */ |