Patchwork [v4,09/10] mtd: nand: utilize oob_required parameter

login
register
mail settings
Submitter Brian Norris
Date May 2, 2012, 5:15 p.m.
Message ID <1335978904-8005-10-git-send-email-computersforpeace@gmail.com>
Download mbox | patch
Permalink /patch/156510/
State New
Headers show

Comments

Brian Norris - May 2, 2012, 5:15 p.m.
Don't read/write OOB if the caller doesn't require it.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
v4 note: I think this patch is safe after killing autoincrement in
         nand_do_read_ops()

 drivers/mtd/nand/nand_base.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 464b742..14e9b32 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1075,7 +1075,8 @@  static int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
 			      uint8_t *buf, int oob_required, int page)
 {
 	chip->read_buf(mtd, buf, mtd->writesize);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	if (oob_required)
+		chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
 	return 0;
 }
 
@@ -1928,7 +1929,8 @@  static void nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
 				const uint8_t *buf, int oob_required)
 {
 	chip->write_buf(mtd, buf, mtd->writesize);
-	chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
+	if (oob_required)
+		chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
 }
 
 /**