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/inftlcore.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/inftlcore.c')
-rw-r--r-- | drivers/mtd/inftlcore.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/mtd/inftlcore.c b/drivers/mtd/inftlcore.c index a1b2de605000..d2f54c037e0f 100644 --- a/drivers/mtd/inftlcore.c +++ b/drivers/mtd/inftlcore.c | |||
@@ -163,10 +163,9 @@ int inftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len, | |||
163 | ops.ooblen = len; | 163 | ops.ooblen = len; |
164 | ops.oobbuf = buf; | 164 | ops.oobbuf = buf; |
165 | ops.datbuf = NULL; | 165 | ops.datbuf = NULL; |
166 | ops.len = len; | ||
167 | 166 | ||
168 | res = mtd->read_oob(mtd, offs & ~(mtd->writesize - 1), &ops); | 167 | res = mtd->read_oob(mtd, offs & ~(mtd->writesize - 1), &ops); |
169 | *retlen = ops.retlen; | 168 | *retlen = ops.oobretlen; |
170 | return res; | 169 | return res; |
171 | } | 170 | } |
172 | 171 | ||
@@ -184,10 +183,9 @@ int inftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len, | |||
184 | ops.ooblen = len; | 183 | ops.ooblen = len; |
185 | ops.oobbuf = buf; | 184 | ops.oobbuf = buf; |
186 | ops.datbuf = NULL; | 185 | ops.datbuf = NULL; |
187 | ops.len = len; | ||
188 | 186 | ||
189 | res = mtd->write_oob(mtd, offs & ~(mtd->writesize - 1), &ops); | 187 | res = mtd->write_oob(mtd, offs & ~(mtd->writesize - 1), &ops); |
190 | *retlen = ops.retlen; | 188 | *retlen = ops.oobretlen; |
191 | return res; | 189 | return res; |
192 | } | 190 | } |
193 | 191 | ||