Patchwork [1/2] mtd: replace the hard code with the proper macro

login
register
mail settings
Submitter Huang Shijie
Date July 3, 2012, 8:44 a.m.
Message ID <1341305055-29218-1-git-send-email-b32955@freescale.com>
Download mbox | patch
Permalink /patch/168739/
State New
Headers show

Comments

Huang Shijie - July 3, 2012, 8:44 a.m.
Use the MTD_OPS_PLACE_OOB to replace the hard code "0".
Make the code more readable.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 drivers/mtd/nand/nand_base.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Brian Norris - July 11, 2012, 1:43 a.m.
On Tue, Jul 3, 2012 at 1:44 AM, Huang Shijie <b32955@freescale.com> wrote:
> Use the MTD_OPS_PLACE_OOB to replace the hard code "0".
> Make the code more readable.

I think I intentionally used 0 instead of an explicit mode, since the
mode was mostly for when oobbuf != NULL; i.e., MTD_OPS_PLACE_OOB vs.
MTD_OPS_AUTO_OOB was a don't care in this case. But now that you
mention it, this is probably more readable.

> Signed-off-by: Huang Shijie <b32955@freescale.com>

Acked-by: Brian Norris <computersforpeace@gmail.com>
Artem Bityutskiy - July 16, 2012, 3:06 p.m.
On Tue, 2012-07-03 at 16:44 +0800, Huang Shijie wrote:
> Use the MTD_OPS_PLACE_OOB to replace the hard code "0".
> Make the code more readable.
> 
> Signed-off-by: Huang Shijie <b32955@freescale.com>

Pushed both to l2-mtd.git, thanks!

Patch

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index c58df65..5b8ab7f 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1633,7 +1633,7 @@  static int nand_read(struct mtd_info *mtd, loff_t from, size_t len,
 	ops.len = len;
 	ops.datbuf = buf;
 	ops.oobbuf = NULL;
-	ops.mode = 0;
+	ops.mode = MTD_OPS_PLACE_OOB;
 	ret = nand_do_read_ops(mtd, from, &ops);
 	*retlen = ops.retlen;
 	nand_release_device(mtd);
@@ -2336,7 +2336,7 @@  static int panic_nand_write(struct mtd_info *mtd, loff_t to, size_t len,
 	ops.len = len;
 	ops.datbuf = (uint8_t *)buf;
 	ops.oobbuf = NULL;
-	ops.mode = 0;
+	ops.mode = MTD_OPS_PLACE_OOB;
 
 	ret = nand_do_write_ops(mtd, to, &ops);
 
@@ -2365,7 +2365,7 @@  static int nand_write(struct mtd_info *mtd, loff_t to, size_t len,
 	ops.len = len;
 	ops.datbuf = (uint8_t *)buf;
 	ops.oobbuf = NULL;
-	ops.mode = 0;
+	ops.mode = MTD_OPS_PLACE_OOB;
 	ret = nand_do_write_ops(mtd, to, &ops);
 	*retlen = ops.retlen;
 	nand_release_device(mtd);