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

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

Comments

Brian Norris - May 2, 2012, 5:14 p.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(-)
Artem Bityutskiy - May 3, 2012, 9:55 a.m.
On Wed, 2012-05-02 at 10:14 -0700, Brian Norris wrote:
> Don't read/write OOB if the caller doesn't require it.
> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>

Hi Mike, do you prefer me to accept this patch or drop?

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);
 }
 
 /*