======== CUT HERE
From: David Brownell <dbrownell@users.sourceforge.net>
Cosmetic fixes to the patch fixing raw HW_SYNDROME read/write.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
drivers/mtd/nand/nand_base.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
@@ -773,10 +773,9 @@ static int nand_read_page_raw_syndrome(s
int eccsize = chip->ecc.size;
int eccbytes = chip->ecc.bytes;
uint8_t *oob = chip->oob_poi;
- int temp;
+ int steps, size;
- temp = chip->ecc.steps;
- do {
+ for (steps = chip->ecc.steps; steps > 0; steps--) {
chip->read_buf(mtd, buf, eccsize);
buf += eccsize;
@@ -792,11 +791,11 @@ static int nand_read_page_raw_syndrome(s
chip->read_buf(mtd, oob, chip->ecc.postpad);
oob += chip->ecc.postpad;
}
- } while (--temp);
+ }
- temp = mtd->oobsize - (oob - chip->oob_poi);
- if (temp)
- chip->read_buf(mtd, oob, temp);
+ size = mtd->oobsize - (oob - chip->oob_poi);
+ if (size)
+ chip->read_buf(mtd, oob, size);
return 0;
}
@@ -1542,7 +1541,7 @@ static void nand_write_page_raw(struct m
* @chip: nand chip info structure
* @buf: data buffer
*
- * We need a special oob layout and handling even when ECC isn't used.
+ * We need a special oob layout and handling even when ECC isn't checked.
*/
static void nand_write_page_raw_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
const uint8_t *buf)
@@ -1550,10 +1549,9 @@ static void nand_write_page_raw_syndrome
int eccsize = chip->ecc.size;
int eccbytes = chip->ecc.bytes;
uint8_t *oob = chip->oob_poi;
- int temp;
+ int steps, size;
- temp = chip->ecc.steps;
- do {
+ for (steps = chip->ecc.steps; steps > 0; steps--) {
chip->write_buf(mtd, buf, eccsize);
buf += eccsize;
@@ -1569,11 +1567,11 @@ static void nand_write_page_raw_syndrome
chip->write_buf(mtd, oob, chip->ecc.postpad);
oob += chip->ecc.postpad;
}
- } while (--temp);
+ }
- temp = mtd->oobsize - (oob - chip->oob_poi);
- if (temp)
- chip->write_buf(mtd, oob, temp);
+ size = mtd->oobsize - (oob - chip->oob_poi);
+ if (size)
+ chip->write_buf(mtd, oob, size);
}
/**
* nand_write_page_swecc - [REPLACABLE] software ecc based page write function