Patchwork [U-Boot,v5,1/3] dfu: unify mmc/nand read/write ops enum

login
register
mail settings
Submitter Afzal Mohammed
Date Sept. 17, 2013, 7:44 p.m.
Message ID <3575eca6f1eabbf3bae20f0dafd21b55c7ff42cc.1379446184.git.afzal.mohd.ma@gmail.com>
Download mbox | patch
Permalink /patch/275526/
State Awaiting Upstream
Delegated to: Marek Vasut
Headers show

Comments

Afzal Mohammed - Sept. 17, 2013, 7:44 p.m.
MMC and NAND independently defines same enumerators for read/write.
Unify them by defining enum in dfu header. RAM support that is being
added newly also can make use of it.

Signed-off-by: Afzal Mohammed <afzal.mohd.ma@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>
---

v5: collect one more tag
v4: collect more tag
v3: collected tag
v2: new

 drivers/dfu/dfu_mmc.c  | 9 ++-------
 drivers/dfu/dfu_nand.c | 7 +------
 include/dfu.h          | 5 +++++
 3 files changed, 8 insertions(+), 13 deletions(-)

Patch

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 0871a77..f942758 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -13,16 +13,11 @@ 
 #include <div64.h>
 #include <dfu.h>
 
-enum dfu_mmc_op {
-	DFU_OP_READ = 1,
-	DFU_OP_WRITE,
-};
-
 static unsigned char __aligned(CONFIG_SYS_CACHELINE_SIZE)
 				dfu_file_buf[CONFIG_SYS_DFU_MAX_FILE_SIZE];
 static long dfu_file_buf_len;
 
-static int mmc_block_op(enum dfu_mmc_op op, struct dfu_entity *dfu,
+static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu,
 			u64 offset, void *buf, long *len)
 {
 	char cmd_buf[DFU_CMD_BUF_SIZE];
@@ -65,7 +60,7 @@  static int mmc_file_buffer(struct dfu_entity *dfu, void *buf, long *len)
 	return 0;
 }
 
-static int mmc_file_op(enum dfu_mmc_op op, struct dfu_entity *dfu,
+static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
 			void *buf, long *len)
 {
 	char cmd_buf[DFU_CMD_BUF_SIZE];
diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
index 0ec12cf..edbf5a9 100644
--- a/drivers/dfu/dfu_nand.c
+++ b/drivers/dfu/dfu_nand.c
@@ -19,12 +19,7 @@ 
 #include <jffs2/load_kernel.h>
 #include <nand.h>
 
-enum dfu_nand_op {
-	DFU_OP_READ = 1,
-	DFU_OP_WRITE,
-};
-
-static int nand_block_op(enum dfu_nand_op op, struct dfu_entity *dfu,
+static int nand_block_op(enum dfu_op op, struct dfu_entity *dfu,
 			u64 offset, void *buf, long *len)
 {
 	loff_t start, lim;
diff --git a/include/dfu.h b/include/dfu.h
index 392cef1..6a3e253 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -29,6 +29,11 @@  enum dfu_layout {
 	DFU_FS_EXT4,
 };
 
+enum dfu_op {
+	DFU_OP_READ = 1,
+	DFU_OP_WRITE,
+};
+
 struct mmc_internal_data {
 	/* RAW programming */
 	unsigned int lba_start;