diff options
author | Brian Norris <computersforpeace@gmail.com> | 2011-08-31 13:00:35 -0700 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-09-11 16:11:41 +0300 |
commit | 040c937ca2c5ae1f35c24a3cc0154e9a31df5933 (patch) | |
tree | e96ca73166ed52360d1036be1c8e0d3ce896bf23 /nandwrite.c | |
parent | 6a8889fbc0ea7a198628c9e3901fd88038e12d09 (diff) |
nandwrite: merge `mtd_write_oob' and `mtd_write' calls
Now that `mtd_write' can write to both OOB and data regions, we need to
perform our `mtd_write' call only once.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Diffstat (limited to 'nandwrite.c')
-rw-r--r-- | nandwrite.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/nandwrite.c b/nandwrite.c index 33a3b8f..a78b0b6 100644 --- a/nandwrite.c +++ b/nandwrite.c @@ -534,17 +534,17 @@ int main(int argc, char * const argv[]) } else { memcpy(oobbuf, oobreadbuf, mtd.oob_size); } - /* Write OOB data first, as ecc will be placed in there */ - if (mtd_write_oob(mtd_desc, &mtd, fd, mtdoffset, - mtd.oob_size, oobbuf)) { - sys_errmsg("%s: MTD writeoob failure", mtd_device); - goto closeall; - } } - /* Write out the Page data */ - if (!onlyoob && mtd_write(mtd_desc, &mtd, fd, mtdoffset / mtd.eb_size, mtdoffset % mtd.eb_size, - writebuf, mtd.min_io_size, NULL, 0, 0)) { + /* Write out data */ + ret = mtd_write(mtd_desc, &mtd, fd, mtdoffset / mtd.eb_size, + mtdoffset % mtd.eb_size, + onlyoob ? NULL : writebuf, + onlyoob ? 0 : mtd.min_io_size, + writeoob ? oobbuf : NULL, + writeoob ? mtd.oob_size : 0, + noecc ? MTD_OPS_RAW : MTD_OPS_PLACE_OOB); + if (ret) { int i; if (errno != EIO) { sys_errmsg("%s: MTD write failure", mtd_device); |