All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 23/34] env: Switch over to use environment location drivers
Date: Sun, 23 Jul 2017 21:19:58 -0600	[thread overview]
Message-ID: <20170724032009.43994-24-sjg@chromium.org> (raw)
In-Reply-To: <20170724032009.43994-1-sjg@chromium.org>

Move over to use a the master implementation of the location drivers, with
each method calling out to the appropriate driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 env/dataflash.c | 16 ++++++++--------
 env/eeprom.c    | 16 ++++++++--------
 env/env.c       | 26 ++++++++++++++++++++++++++
 env/ext4.c      | 13 ++++++-------
 env/fat.c       | 13 ++++++-------
 env/flash.c     | 34 ++++++++++++++++++----------------
 env/mmc.c       | 27 +++++++++++++--------------
 env/nand.c      | 14 +++++++-------
 env/nowhere.c   |  8 ++++----
 env/nvram.c     | 16 ++++++++--------
 env/onenand.c   | 13 ++++++-------
 env/remote.c    | 13 ++++++-------
 env/sata.c      | 13 ++++++-------
 env/sf.c        | 17 ++++++++---------
 env/ubi.c       | 17 ++++++++---------
 15 files changed, 138 insertions(+), 118 deletions(-)

diff --git a/env/dataflash.c b/env/dataflash.c
index 9c59d8e63a..6d95d6409b 100644
--- a/env/dataflash.c
+++ b/env/dataflash.c
@@ -18,7 +18,7 @@ env_t *env_ptr;
 
 char *env_name_spec = "dataflash";
 
-uchar env_get_char_spec(int index)
+static unsigned char env_dataflash_get_char(int index)
 {
 	uchar c;
 
@@ -27,7 +27,7 @@ uchar env_get_char_spec(int index)
 	return c;
 }
 
-void env_relocate_spec(void)
+static void env_dataflash_load(void)
 {
 	ulong crc, new = 0;
 	unsigned off;
@@ -54,7 +54,7 @@ void env_relocate_spec(void)
 #error No support for redundant environment on dataflash yet!
 #endif
 
-int saveenv(void)
+static int env_dataflash_save(void)
 {
 	env_t env_new;
 	int ret;
@@ -74,7 +74,7 @@ int saveenv(void)
  * We are still running from ROM, so data use is limited.
  * Use a (moderately small) buffer on the stack
  */
-int env_init(void)
+int env_dataflash_init(void)
 {
 	/* use default */
 	gd->env_addr = (ulong)&default_environment[0];
@@ -85,8 +85,8 @@ int env_init(void)
 
 U_BOOT_ENV_LOCATION(dataflash) = {
 	.location	= ENVL_DATAFLASH,
-	.get_char	= env_get_char_spec,
-	.load		= env_relocate_spec,
-	.save		= env_save_ptr(saveenv),
-	.init		= env_init,
+	.get_char	= env_dataflash_get_char,
+	.load		= env_dataflash_load,
+	.save		= env_save_ptr(env_dataflash_save),
+	.init		= env_dataflash_init,
 };
diff --git a/env/eeprom.c b/env/eeprom.c
index 78569b286b..eb69f75f7b 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -65,7 +65,7 @@ static int eeprom_bus_write(unsigned dev_addr, unsigned offset,
 	return rcode;
 }
 
-uchar env_get_char_spec(int index)
+static uchar env_eeprom_get_char(int index)
 {
 	uchar c;
 	unsigned int off = CONFIG_ENV_OFFSET;
@@ -80,7 +80,7 @@ uchar env_get_char_spec(int index)
 	return c;
 }
 
-void env_relocate_spec(void)
+static void env_eeprom_load(void)
 {
 	char buf_env[CONFIG_ENV_SIZE];
 	unsigned int off = CONFIG_ENV_OFFSET;
@@ -188,7 +188,7 @@ void env_relocate_spec(void)
 	env_import(buf_env, 1);
 }
 
-int saveenv(void)
+static int env_eeprom_save(void)
 {
 	env_t	env_new;
 	int	rc;
@@ -237,7 +237,7 @@ int saveenv(void)
  * We are still running from ROM, so data use is limited.
  * Use a (moderately small) buffer on the stack
  */
-int env_init(void)
+static int env_eeprom_init(void)
 {
 	gd->env_addr = (ulong)&default_environment[0];
 	gd->env_valid = ENV_VALID;
@@ -246,8 +246,8 @@ int env_init(void)
 
 U_BOOT_ENV_LOCATION(eeprom) = {
 	.location	= ENVL_EEPROM,
-	.get_char	= env_get_char_spec,
-	.load		= env_relocate_spec,
-	.save		= env_save_ptr(saveenv),
-	.init		= env_init,
+	.get_char	= env_eeprom_get_char,
+	.load		= env_eeprom_load,
+	.save		= env_save_ptr(env_eeprom_save),
+	.init		= env_eeprom_init,
 };
diff --git a/env/env.c b/env/env.c
index 9f0a04c33c..608ab7bb39 100644
--- a/env/env.c
+++ b/env/env.c
@@ -143,3 +143,29 @@ int env_init_new(void)
 
 	return 0;
 }
+
+unsigned char env_get_char_spec(int index)
+{
+	int ch;
+
+	ch = env_get_char(index);
+	if (ch < 0)
+		return 0;
+
+	return ch;
+}
+
+void env_relocate_spec(void)
+{
+	env_load();
+}
+
+int saveenv(void)
+{
+	return env_save();
+}
+
+int env_init(void)
+{
+	return env_init_new();
+}
diff --git a/env/ext4.c b/env/ext4.c
index c6a84925d9..aa69219021 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -37,7 +37,7 @@ env_t *env_ptr;
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int env_init(void)
+static int env_ext4_init(void)
 {
 	/* use default */
 	gd->env_addr = (ulong)&default_environment[0];
@@ -47,7 +47,7 @@ int env_init(void)
 }
 
 #ifdef CONFIG_CMD_SAVEENV
-int saveenv(void)
+static int env_ext4_save(void)
 {
 	env_t	env_new;
 	struct blk_desc *dev_desc = NULL;
@@ -88,7 +88,7 @@ int saveenv(void)
 }
 #endif /* CONFIG_CMD_SAVEENV */
 
-void env_relocate_spec(void)
+static void env_ext4_load(void)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
 	struct blk_desc *dev_desc = NULL;
@@ -130,8 +130,7 @@ err_env_relocate:
 
 U_BOOT_ENV_LOCATION(ext4) = {
 	.location	= ENVL_EXT4,
-	.get_char	= env_get_char_spec,
-	.load		= env_relocate_spec,
-	.save		= env_save_ptr(saveenv),
-	.init		= env_init,
+	.load		= env_ext4_load,
+	.save		= env_save_ptr(env_ext4_save),
+	.init		= env_ext4_init,
 };
diff --git a/env/fat.c b/env/fat.c
index 8f5fff81ad..f7abfdb952 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -37,7 +37,7 @@ env_t *env_ptr;
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int env_init(void)
+static int env_fat_init(void)
 {
 	/* use default */
 	gd->env_addr = (ulong)&default_environment[0];
@@ -47,7 +47,7 @@ int env_init(void)
 }
 
 #ifdef CMD_SAVEENV
-int saveenv(void)
+static int env_fat_save(void)
 {
 	env_t	env_new;
 	struct blk_desc *dev_desc = NULL;
@@ -87,7 +87,7 @@ int saveenv(void)
 #endif /* CMD_SAVEENV */
 
 #ifdef LOADENV
-void env_relocate_spec(void)
+static void env_fat_load(void)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
 	struct blk_desc *dev_desc = NULL;
@@ -125,12 +125,11 @@ err_env_relocate:
 
 U_BOOT_ENV_LOCATION(fat) = {
 	.location	= ENVL_FAT,
-	.get_char	= env_get_char_spec,
 #ifdef LOADENV
-	.load		= env_relocate_spec,
+	.load		= env_fat_load,
 #endif
 #ifdef CMD_SAVEENV
-	.save		= env_save_ptr(saveenv),
+	.save		= env_save_ptr(env_fat_save),
 #endif
-	.init		= env_init,
+	.init		= env_fat_init,
 };
diff --git a/env/flash.c b/env/flash.c
index cf068d11ee..6ec9b61883 100644
--- a/env/flash.c
+++ b/env/flash.c
@@ -50,30 +50,30 @@ char *env_name_spec = "Flash";
 #ifdef ENV_IS_EMBEDDED
 env_t *env_ptr = &environment;
 
-static env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
+static __maybe_unused env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
 
 #else /* ! ENV_IS_EMBEDDED */
 
 env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
-static env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
+static __maybe_unused env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
 #endif /* ENV_IS_EMBEDDED */
 
-#if defined(CMD_SAVEENV) || defined(CONFIG_ENV_ADDR_REDUND)
 /* CONFIG_ENV_ADDR is supposed to be on sector boundary */
-static ulong end_addr = CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1;
-#endif
+static ulong __maybe_unused end_addr =
+		CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1;
 
 #ifdef CONFIG_ENV_ADDR_REDUND
-static env_t *flash_addr_new = (env_t *)CONFIG_ENV_ADDR_REDUND;
+
+static env_t __maybe_unused *flash_addr_new = (env_t *)CONFIG_ENV_ADDR_REDUND;
 
 /* CONFIG_ENV_ADDR_REDUND is supposed to be on sector boundary */
-static ulong end_addr_new = CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1;
+static ulong __maybe_unused end_addr_new =
+		CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1;
 #endif /* CONFIG_ENV_ADDR_REDUND */
 
-
 #ifdef CONFIG_ENV_ADDR_REDUND
 #ifdef INITENV
-int env_init(void)
+static int env_flash_init(void)
 {
 	int crc1_ok = 0, crc2_ok = 0;
 
@@ -119,7 +119,7 @@ int env_init(void)
 #endif
 
 #ifdef CMD_SAVEENV
-int saveenv(void)
+static int env_flash_save(void)
 {
 	env_t	env_new;
 	char	*saved_data = NULL;
@@ -224,7 +224,7 @@ done:
 #else /* ! CONFIG_ENV_ADDR_REDUND */
 
 #ifdef INITENV
-int env_init(void)
+static int env_flash_init(void)
 {
 	if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
 		gd->env_addr	= (ulong)&(env_ptr->data);
@@ -239,7 +239,7 @@ int env_init(void)
 #endif
 
 #ifdef CMD_SAVEENV
-int saveenv(void)
+static int env_flash_save(void)
 {
 	env_t	env_new;
 	int	rc = 1;
@@ -309,7 +309,8 @@ done:
 
 #endif /* CONFIG_ENV_ADDR_REDUND */
 
-void env_relocate_spec(void)
+#ifdef LOADENV
+static void env_flash_load(void)
 {
 #ifdef CONFIG_ENV_ADDR_REDUND
 	if (gd->env_addr != (ulong)&(flash_addr->data)) {
@@ -354,16 +355,17 @@ void env_relocate_spec(void)
 
 	env_import((char *)flash_addr, 1);
 }
+#endif /* LOADENV */
 
 U_BOOT_ENV_LOCATION(flash) = {
 	.location	= ENVL_FLASH,
 #ifdef LOADENV
-	.load		= env_relocate_spec,
+	.load		= env_flash_load,
 #endif
 #ifdef CMD_SAVEENV
-	.save		= env_save_ptr(saveenv),
+	.save		= env_save_ptr(env_flash_save),
 #endif
 #ifdef INITENV
-	.init		= env_init,
+	.init		= env_flash_init,
 #endif
 };
diff --git a/env/mmc.c b/env/mmc.c
index 4249182d58..2bdeeb7dc6 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -82,7 +82,7 @@ __weak int mmc_get_env_dev(void)
 	return CONFIG_SYS_MMC_ENV_DEV;
 }
 
-int env_init(void)
+static int env_mmc_init(void)
 {
 	/* use default */
 	gd->env_addr	= (ulong)&default_environment[0];
@@ -145,7 +145,11 @@ static void fini_mmc_for_env(struct mmc *mmc)
 #endif
 }
 
-#ifdef CONFIG_CMD_SAVEENV
+#ifdef CONFIG_ENV_OFFSET_REDUND
+static unsigned char env_flags;
+#endif
+
+#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_SPL_BUILD)
 static inline int write_env(struct mmc *mmc, unsigned long size,
 			    unsigned long offset, const void *buffer)
 {
@@ -160,11 +164,7 @@ static inline int write_env(struct mmc *mmc, unsigned long size,
 	return (n == blk_cnt) ? 0 : -1;
 }
 
-#ifdef CONFIG_ENV_OFFSET_REDUND
-static unsigned char env_flags;
-#endif
-
-int saveenv(void)
+static int env_mmc_save(void)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
 	int dev = mmc_get_env_dev();
@@ -213,7 +213,7 @@ fini:
 	fini_mmc_for_env(mmc);
 	return ret;
 }
-#endif /* CONFIG_CMD_SAVEENV */
+#endif /* CONFIG_CMD_SAVEENV && !CONFIG_SPL_BUILD */
 
 static inline int read_env(struct mmc *mmc, unsigned long size,
 			   unsigned long offset, const void *buffer)
@@ -230,7 +230,7 @@ static inline int read_env(struct mmc *mmc, unsigned long size,
 }
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-void env_relocate_spec(void)
+static void env_mmc_load(void)
 {
 #if !defined(ENV_IS_EMBEDDED)
 	struct mmc *mmc;
@@ -314,7 +314,7 @@ err:
 #endif
 }
 #else /* ! CONFIG_ENV_OFFSET_REDUND */
-void env_relocate_spec(void)
+static void env_mmc_load(void)
 {
 #if !defined(ENV_IS_EMBEDDED)
 	ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
@@ -357,10 +357,9 @@ err:
 
 U_BOOT_ENV_LOCATION(mmc) = {
 	.location	= ENVL_MMC,
-	.get_char	= env_get_char_spec,
-	.load		= env_relocate_spec,
+	.load		= env_mmc_load,
 #ifndef CONFIG_SPL_BUILD
-	.save		= env_save_ptr(saveenv),
+	.save		= env_save_ptr(env_mmc_save),
 #endif
-	.init		= env_init,
+	.init		= env_mmc_init,
 };
diff --git a/env/nand.c b/env/nand.c
index 3e7c30600f..23cb812d78 100644
--- a/env/nand.c
+++ b/env/nand.c
@@ -64,7 +64,7 @@ DECLARE_GLOBAL_DATA_PTR;
  * This way the SPL loads not only the U-Boot image from NAND but
  * also the environment.
  */
-int env_init(void)
+static int env_nand_init(void)
 {
 #if defined(ENV_IS_EMBEDDED) || defined(CONFIG_NAND_ENV_DST)
 	int crc1_ok = 0, crc2_ok = 0;
@@ -189,7 +189,7 @@ static int erase_and_write_env(const struct nand_env_location *location,
 static unsigned char env_flags;
 #endif
 
-int saveenv(void)
+static int env_nand_save(void)
 {
 	int	ret = 0;
 	ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
@@ -322,7 +322,7 @@ int get_nand_env_oob(struct mtd_info *mtd, unsigned long *result)
 #endif
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-void env_relocate_spec(void)
+static void env_nand_load(void)
 {
 #if !defined(ENV_IS_EMBEDDED)
 	int read1_fail = 0, read2_fail = 0;
@@ -394,7 +394,7 @@ done:
  * device i.e., nand_dev_desc + 0. This is also the behaviour using
  * the new NAND code.
  */
-void env_relocate_spec(void)
+static void env_nand_load(void)
 {
 #if !defined(ENV_IS_EMBEDDED)
 	int ret;
@@ -427,9 +427,9 @@ void env_relocate_spec(void)
 
 U_BOOT_ENV_LOCATION(nand) = {
 	.location	= ENVL_NAND,
-	.load		= env_relocate_spec,
+	.load		= env_nand_load,
 #if defined(CMD_SAVEENV)
-	.save		= env_save_ptr(saveenv),
+	.save		= env_save_ptr(env_nand_save),
 #endif
-	.init		= env_init,
+	.init		= env_nand_init,
 };
diff --git a/env/nowhere.c b/env/nowhere.c
index c58d299308..6a67ab09ff 100644
--- a/env/nowhere.c
+++ b/env/nowhere.c
@@ -17,7 +17,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 env_t *env_ptr;
 
-void env_relocate_spec(void)
+static void env_nowhere_load(void)
 {
 }
 
@@ -26,7 +26,7 @@ void env_relocate_spec(void)
  *
  * We are still running from ROM, so data use is limited
  */
-int env_init(void)
+static int env_nowhere_init(void)
 {
 	gd->env_addr	= (ulong)&default_environment[0];
 	gd->env_valid	= 0;
@@ -36,6 +36,6 @@ int env_init(void)
 
 U_BOOT_ENV_LOCATION(nowhere) = {
 	.location	= ENVL_NOWHERE,
-	.load		= env_relocate_spec,
-	.init		= env_init,
+	.load		= env_nowhere_load,
+	.init		= env_nowhere_init,
 };
diff --git a/env/nvram.c b/env/nvram.c
index 4f45eae73e..09091b8eb7 100644
--- a/env/nvram.c
+++ b/env/nvram.c
@@ -44,7 +44,7 @@ env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
 char *env_name_spec = "NVRAM";
 
 #ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
-uchar env_get_char_spec(int index)
+static uchar env_nvram_get_char(int index)
 {
 	uchar c;
 
@@ -54,7 +54,7 @@ uchar env_get_char_spec(int index)
 }
 #endif
 
-void env_relocate_spec(void)
+static void env_nvram_load(void)
 {
 	char buf[CONFIG_ENV_SIZE];
 
@@ -66,7 +66,7 @@ void env_relocate_spec(void)
 	env_import(buf, 1);
 }
 
-int saveenv(void)
+static int env_nvram_save(void)
 {
 	env_t	env_new;
 	int	rcode = 0;
@@ -89,7 +89,7 @@ int saveenv(void)
  *
  * We are still running from ROM, so data use is limited
  */
-int env_init(void)
+static int env_nvram_init(void)
 {
 #if defined(CONFIG_SYS_NVRAM_ACCESS_ROUTINE)
 	ulong crc;
@@ -116,9 +116,9 @@ int env_init(void)
 U_BOOT_ENV_LOCATION(nvram) = {
 	.location	= ENVL_NVRAM,
 #ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
-	.get_char	= env_get_char_spec,
+	.get_char	= env_nvram_get_char,
 #endif
-	.load		= env_relocate_spec,
-	.save		= env_save_ptr(saveenv),
-	.init		= env_init,
+	.load		= env_nvram_load,
+	.save		= env_save_ptr(env_nvram_save),
+	.init		= env_nvram_init,
 };
diff --git a/env/onenand.c b/env/onenand.c
index d4dfc02a46..f72aa4b036 100644
--- a/env/onenand.c
+++ b/env/onenand.c
@@ -28,7 +28,7 @@ char *env_name_spec = "OneNAND";
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void env_relocate_spec(void)
+static void env_onenand_load(void)
 {
 	struct mtd_info *mtd = &onenand_mtd;
 #ifdef CONFIG_ENV_ADDR_FLEX
@@ -63,7 +63,7 @@ void env_relocate_spec(void)
 		gd->env_valid = ENV_VALID;
 }
 
-int saveenv(void)
+static int env_onenand_save(void)
 {
 	env_t	env_new;
 	int ret;
@@ -106,7 +106,7 @@ int saveenv(void)
 	return 0;
 }
 
-int env_init(void)
+static int env_onenand_init(void)
 {
 	/* use default */
 	gd->env_addr = (ulong)&default_environment[0];
@@ -117,8 +117,7 @@ int env_init(void)
 
 U_BOOT_ENV_LOCATION(onenand) = {
 	.location	= ENVL_ONENAND,
-	.get_char	= env_get_char_spec,
-	.load		= env_relocate_spec,
-	.save		= env_save_ptr(saveenv),
-	.init		= env_init,
+	.load		= env_onenand_load,
+	.save		= env_save_ptr(env_onenand_save),
+	.init		= env_onenand_init,
 };
diff --git a/env/remote.c b/env/remote.c
index c221d55c4f..0324cba099 100644
--- a/env/remote.c
+++ b/env/remote.c
@@ -25,7 +25,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define CONFIG_ENV_OFFSET 0
 #endif
 
-int env_init(void)
+static int env_remote_init(void)
 {
 	if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
 		gd->env_addr = (ulong)&(env_ptr->data);
@@ -39,7 +39,7 @@ int env_init(void)
 }
 
 #ifdef CONFIG_CMD_SAVEENV
-int saveenv(void)
+static int env_remote_save(void)
 {
 #ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
 	printf("Can not support the 'saveenv' when boot from SRIO or PCIE!\n");
@@ -50,7 +50,7 @@ int saveenv(void)
 }
 #endif /* CONFIG_CMD_SAVEENV */
 
-void env_relocate_spec(void)
+static void env_remote_load(void)
 {
 #ifndef ENV_IS_EMBEDDED
 	env_import((char *)env_ptr, 1);
@@ -59,8 +59,7 @@ void env_relocate_spec(void)
 
 U_BOOT_ENV_LOCATION(remote) = {
 	.location	= ENVL_REMOTE,
-	.get_char	= env_get_char_spec,
-	.load		= env_relocate_spec,
-	.save		= env_save_ptr(saveenv),
-	.init		= env_init,
+	.load		= env_remote_load,
+	.save		= env_save_ptr(env_remote_save),
+	.init		= env_remote_init,
 };
diff --git a/env/sata.c b/env/sata.c
index f7b159a347..6f9099873d 100644
--- a/env/sata.c
+++ b/env/sata.c
@@ -33,7 +33,7 @@ __weak int sata_get_env_dev(void)
 	return CONFIG_SYS_SATA_ENV_DEV;
 }
 
-int env_init(void)
+static int env_sata_init(void)
 {
 	/* use default */
 	gd->env_addr = (ulong)&default_environment[0];
@@ -56,7 +56,7 @@ static inline int write_env(struct blk_desc *sata, unsigned long size,
 	return (n == blk_cnt) ? 0 : -1;
 }
 
-int saveenv(void)
+static int env_sata_save(void)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
 	struct blk_desc *sata = NULL;
@@ -102,7 +102,7 @@ static inline int read_env(struct blk_desc *sata, unsigned long size,
 	return (n == blk_cnt) ? 0 : -1;
 }
 
-void env_relocate_spec(void)
+static void env_sata_load(void)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
 	struct blk_desc *sata = NULL;
@@ -128,8 +128,7 @@ void env_relocate_spec(void)
 
 U_BOOT_ENV_LOCATION(sata) = {
 	.location	= ENVL_ESATA,
-	.get_char	= env_get_char_spec,
-	.load		= env_relocate_spec,
-	.save		= env_save_ptr(saveenv),
-	.init		= env_init,
+	.load		= env_sata_load,
+	.save		= env_save_ptr(env_sata_save),
+	.init		= env_sata_init,
 };
diff --git a/env/sf.c b/env/sf.c
index 8f81cf5e40..82babaab67 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -84,7 +84,7 @@ static int setup_flash_device(void)
 
 #if defined(CONFIG_ENV_OFFSET_REDUND)
 #ifdef CMD_SAVEENV
-int saveenv(void)
+static int env_sf_save(void)
 {
 	env_t	env_new;
 	char	*saved_buffer = NULL, flag = OBSOLETE_FLAG;
@@ -164,7 +164,7 @@ int saveenv(void)
 }
 #endif /* CMD_SAVEENV */
 
-void env_relocate_spec(void)
+static void env_sf_load(void)
 {
 	int ret;
 	int crc1_ok = 0, crc2_ok = 0;
@@ -249,7 +249,7 @@ out:
 }
 #else
 #ifdef CMD_SAVEENV
-int saveenv(void)
+static int env_sf_save(void)
 {
 	u32	saved_size, saved_offset, sector;
 	char	*saved_buffer = NULL;
@@ -310,7 +310,7 @@ int saveenv(void)
 }
 #endif /* CMD_SAVEENV */
 
-void env_relocate_spec(void)
+static void env_sf_load(void)
 {
 	int ret;
 	char *buf = NULL;
@@ -344,7 +344,7 @@ out:
 }
 #endif
 
-int env_init(void)
+static int env_sf_init(void)
 {
 	/* SPI flash isn't usable before relocation */
 	gd->env_addr = (ulong)&default_environment[0];
@@ -355,10 +355,9 @@ int env_init(void)
 
 U_BOOT_ENV_LOCATION(sf) = {
 	.location	= ENVL_SPI_FLASH,
-	.get_char	= env_get_char_spec,
-	.load		= env_relocate_spec,
+	.load		= env_sf_load,
 #ifdef CMD_SAVEENV
-	.save		= env_save_ptr(saveenv),
+	.save		= env_save_ptr(env_sf_save),
 #endif
-	.init		= env_init,
+	.init		= env_sf_init,
 };
diff --git a/env/ubi.c b/env/ubi.c
index 16f6d74d2e..82a9c3bd03 100644
--- a/env/ubi.c
+++ b/env/ubi.c
@@ -22,7 +22,7 @@ env_t *env_ptr;
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int env_init(void)
+static int env_ubi_init(void)
 {
 	/* use default */
 	gd->env_addr = (ulong)&default_environment[0];
@@ -35,7 +35,7 @@ int env_init(void)
 #ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
 static unsigned char env_flags;
 
-int saveenv(void)
+static int env_ubi_save(void)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
 	int ret;
@@ -79,7 +79,7 @@ int saveenv(void)
 	return 0;
 }
 #else /* ! CONFIG_SYS_REDUNDAND_ENVIRONMENT */
-int saveenv(void)
+static int env_ubi_save(void)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
 	int ret;
@@ -108,7 +108,7 @@ int saveenv(void)
 #endif /* CONFIG_CMD_SAVEENV */
 
 #ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
-void env_relocate_spec(void)
+static void env_ubi_load(void)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(char, env1_buf, CONFIG_ENV_SIZE);
 	ALLOC_CACHE_ALIGN_BUFFER(char, env2_buf, CONFIG_ENV_SIZE);
@@ -181,7 +181,7 @@ void env_relocate_spec(void)
 	env_import((char *)ep, 0);
 }
 #else /* ! CONFIG_SYS_REDUNDAND_ENVIRONMENT */
-void env_relocate_spec(void)
+static void env_ubi_load(void)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
 
@@ -215,8 +215,7 @@ void env_relocate_spec(void)
 
 U_BOOT_ENV_LOCATION(ubi) = {
 	.location	= ENVL_UBI,
-	.get_char	= env_get_char_spec,
-	.load		= env_relocate_spec,
-	.save		= env_save_ptr(saveenv),
-	.init		= env_init,
+	.load		= env_ubi_load,
+	.save		= env_save_ptr(env_ubi_save),
+	.init		= env_ubi_init,
 };
-- 
2.14.0.rc0.284.gd933b75aa4-goog

  parent reply	other threads:[~2017-07-24  3:19 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24  3:19 [U-Boot] [PATCH v2 00/34] env: Move environment code to use location drivers Simon Glass
2017-07-24  3:19 ` [U-Boot] [PATCH v2 01/34] configs: Resync with savedefconfig Simon Glass
2017-07-24  3:19 ` [U-Boot] [PATCH v2 02/34] Makefile: Rename 'env' target to 'environ' Simon Glass
2017-07-26 16:13   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 03/34] Move environment files from common/ to env/ Simon Glass
2017-07-26 16:13   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 04/34] Convert CONFIG_ENV_IS_IN_MMC et al to Kconfig Simon Glass
2017-07-26  1:36   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 05/34] env: Move help from README " Simon Glass
2017-07-26  1:36   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 06/34] Convert CONFIG_ENV_IS_IN_FLASH " Simon Glass
2017-07-26  1:36   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 07/34] Convert CONFIG_ENV_IS_IN_NVRAM " Simon Glass
2017-07-26  1:36   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 08/34] Convert CONFIG_ENV_IS_IN_EEPROM " Simon Glass
2017-07-26  1:36   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 09/34] Convert CONFIG_ENV_IS_IN_DATAFLASH " Simon Glass
2017-07-26  1:36   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 10/34] Convert CONFIG_ENV_IS_IN_SPI_FLASH " Simon Glass
2017-07-26  1:36   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 11/34] Convert CONFIG_ENV_IS_IN_REMOTE " Simon Glass
2017-07-26  1:36   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 12/34] Convert CONFIG_ENV_IS_IN_FAT " Simon Glass
2017-07-26  1:36   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 13/34] Convert CONFIG_ENV_IS_IN_ONENAND " Simon Glass
2017-07-26  1:36   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 14/34] env: common: Make env_get_addr/get_char_memory() static Simon Glass
2017-07-26 16:13   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 15/34] env: common: Drop env_get_addr() Simon Glass
2017-07-26 16:13   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 16/34] env: common: Factor out the common env_valid check Simon Glass
2017-07-26 16:13   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 17/34] env: common: Drop env_get_char_init() Simon Glass
2017-07-26 16:14   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 18/34] env: common: Drop env_get_char_memory() Simon Glass
2017-07-26 16:14   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 19/34] env: Add an enum for environment state Simon Glass
2017-07-26 16:14   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 20/34] env: Rename nand env_location to nand_env_location Simon Glass
2017-07-26 16:14   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 21/34] env: Create a location driver for each location Simon Glass
2017-07-26 16:02   ` Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 22/34] env: Add a new implementation of environment access Simon Glass
2017-07-26 16:04   ` Tom Rini
2017-07-26 16:32     ` Simon Glass
2017-07-26 17:23       ` Tom Rini
2017-07-26 18:02         ` Simon Glass
2017-07-26 20:13           ` Tom Rini
2017-08-01  9:49             ` Simon Glass
2017-07-24  3:19 ` Simon Glass [this message]
2017-07-26 16:14   ` [U-Boot] [PATCH v2 23/34] env: Switch over to use environment location drivers Tom Rini
2017-07-24  3:19 ` [U-Boot] [PATCH v2 24/34] env: Drop common init() functions Simon Glass
2017-07-26 16:14   ` Tom Rini
2017-07-24  3:20 ` [U-Boot] [PATCH v2 25/34] env: Drop the env_name_spec global Simon Glass
2017-07-26 16:14   ` Tom Rini
2017-07-24  3:20 ` [U-Boot] [PATCH v2 26/34] env: Drop unused env_ptr variables Simon Glass
2017-07-26 16:14   ` Tom Rini
2017-07-24  3:20 ` [U-Boot] [PATCH v2 27/34] env: Drop env_init_new() Simon Glass
2017-07-26 16:14   ` Tom Rini
2017-07-24  3:20 ` [U-Boot] [PATCH v2 28/34] env: Drop env_get_char_spec() Simon Glass
2017-07-26 16:15   ` Tom Rini
2017-07-24  3:20 ` [U-Boot] [PATCH v2 29/34] env: Drop env_relocate_spec() in favour of env_load() Simon Glass
2017-07-26 16:15   ` Tom Rini
2017-07-24  3:20 ` [U-Boot] [PATCH v2 30/34] env: Drop saveenv() in favour of env_save() Simon Glass
2017-07-26 16:15   ` Tom Rini
2017-07-24  3:20 ` [U-Boot] [PATCH v2 31/34] env: Rename setenv() and friends to env_set() Simon Glass
2017-07-26 16:11   ` Tom Rini
2017-07-26 16:28     ` Simon Glass
2017-07-26 17:29       ` Tom Rini
2017-07-26 17:43         ` Tom Rini
2017-07-26 18:34           ` Simon Glass
2017-07-26 20:14             ` Tom Rini
2017-07-24  3:20 ` [U-Boot] [PATCH v2 32/34] env: Rename getenv() and friends to env_get() Simon Glass
2017-07-26 16:12   ` Tom Rini
2017-07-24  3:20 ` [U-Boot] [PATCH v2 33/34] env: Adjust the get_char() method to return an int Simon Glass
2017-07-26 16:15   ` Tom Rini
2017-07-24  3:20 ` [U-Boot] [PATCH v2 34/34] env: Adjust the load() method to return an error Simon Glass
2017-07-26 16:15   ` Tom Rini
2017-07-25 17:49 ` [U-Boot] [PATCH v2 00/34] env: Move environment code to use location drivers Tom Rini
2017-07-25 21:40   ` Simon Glass
2017-07-25 21:47     ` Tom Rini
2017-07-26  4:51 ` Masahiro Yamada
2017-07-28  3:40   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170724032009.43994-24-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.