Patchwork [v3,03/10] mtd: Blackfin NFC: utilize oob_required parameter

login
register
mail settings
Submitter Brian Norris
Date April 28, 2012, 1:29 a.m.
Message ID <1335576594-25267-4-git-send-email-computersforpeace@gmail.com>
Download mbox | patch
Permalink /patch/155610/
State New
Headers show

Comments

Brian Norris - April 28, 2012, 1:29 a.m.
Don't read/write OOB if the caller doesn't require it.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 drivers/mtd/nand/bf5xx_nand.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
index 3f1c185..8188416 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
@@ -561,7 +561,8 @@  static int bf5xx_nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip
 		uint8_t *buf, int oob_required, int page)
 {
 	bf5xx_nand_read_buf(mtd, buf, mtd->writesize);
-	bf5xx_nand_read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	if (oob_required)
+		bf5xx_nand_read_buf(mtd, chip->oob_poi, mtd->oobsize);
 
 	return 0;
 }
@@ -570,7 +571,8 @@  static void bf5xx_nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *ch
 		const uint8_t *buf, int oob_required)
 {
 	bf5xx_nand_write_buf(mtd, buf, mtd->writesize);
-	bf5xx_nand_write_buf(mtd, chip->oob_poi, mtd->oobsize);
+	if (oob_required)
+		bf5xx_nand_write_buf(mtd, chip->oob_poi, mtd->oobsize);
 }
 
 /*