[U-Boot] [PATCH v6 17/76] spi_flash: Use spi_flash_t instead of struct spi_flash

Jagan Teki jteki at openedev.com
Sun Feb 14 21:48:16 CET 2016


spi_flash_t same typedef alias name for spi_flash
and mtd_info so which one will use based on the
user config definition.

Cc: Simon Glass <sjg at chromium.org>
Cc: Bin Meng <bmeng.cn at gmail.com>
Cc: Mugunthan V N <mugunthanvnm at ti.com>
Cc: Michal Simek <michal.simek at xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
Signed-off-by: Jagan Teki <jteki at openedev.com>
---
 cmd/sf.c            | 10 +++++-----
 common/env_sf.c     |  2 +-
 include/spi_flash.h |  2 ++
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/cmd/sf.c b/cmd/sf.c
index 0fda27c..5dd7177 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -19,7 +19,7 @@
 #include <asm/io.h>
 #include <dm/device-internal.h>
 
-static struct spi_flash *flash;
+static spi_flash_t *flash;
 
 /*
  * This function computes the length argument for the erase command.
@@ -89,7 +89,7 @@ static int do_spi_flash_probe(int argc, char * const argv[])
 	struct udevice *new, *bus_dev;
 	int ret;
 #else
-	struct spi_flash *new;
+	spi_flash_t *new;
 #endif
 
 	if (argc >= 2) {
@@ -166,7 +166,7 @@ static int do_spi_flash_probe(int argc, char * const argv[])
  * @param skipped	Count of skipped data (incremented by this function)
  * @return NULL if OK, else a string containing the stage which failed
  */
-static const char *spi_flash_update_block(struct spi_flash *flash, u32 offset,
+static const char *spi_flash_update_block(spi_flash_t *flash, u32 offset,
 		size_t len, const char *buf, char *cmp_buf, size_t *skipped)
 {
 	char *ptr = (char *)buf;
@@ -208,7 +208,7 @@ static const char *spi_flash_update_block(struct spi_flash *flash, u32 offset,
  * @param buf		buffer to write from
  * @return 0 if ok, 1 on error
  */
-static int spi_flash_update(struct spi_flash *flash, u32 offset,
+static int spi_flash_update(spi_flash_t *flash, u32 offset,
 		size_t len, const char *buf)
 {
 	const char *err_oper = NULL;
@@ -436,7 +436,7 @@ static void spi_test_next_stage(struct test_info *test)
  * @param vbuf		Verification buffer
  * @return 0 if ok, -1 on error
  */
-static int spi_flash_test(struct spi_flash *flash, uint8_t *buf, ulong len,
+static int spi_flash_test(spi_flash_t *flash, uint8_t *buf, ulong len,
 			   ulong offset, uint8_t *vbuf)
 {
 	struct test_info test;
diff --git a/common/env_sf.c b/common/env_sf.c
index 6d5d847..cf909c0 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -43,7 +43,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 char *env_name_spec = "SPI Flash";
 
-static struct spi_flash *env_flash;
+static spi_flash_t *env_flash;
 
 #if defined(CONFIG_ENV_OFFSET_REDUND)
 int saveenv(void)
diff --git a/include/spi_flash.h b/include/spi_flash.h
index 9c8e52c..29c07f5 100644
--- a/include/spi_flash.h
+++ b/include/spi_flash.h
@@ -173,6 +173,8 @@ void spi_flash_free(spi_flash_t *flash);
 
 #else
 
+typedef struct spi_flash spi_flash_t;
+
 static inline int spi_flash_protect(struct spi_flash *flash, u32 ofs, u32 len,
 					bool prot)
 {
-- 
1.9.1



More information about the U-Boot mailing list