env: Make more use of the ENV_SAVE_PTR macro
PATCH 1/1 env: Make more use of the ENV_SAVE_PTR macro
With commit 82b2f4135719 ("env_internal.h: add alternative ENV_SAVE_PTR macro") we introduced the ENV_SAVE_PTR macro but as explained in the commit message, left full conversion for a later time. This commit makes more progress on that front by doing the remaining easy conversions to the new macro.
---
Cc Rasmus Villemoes <[email protected]>
--- env/eeprom.c | 2 +- env/nvram.c | 2 +- env/onenand.c | 2 +- env/remote.c | 2 +- env/scsi.c | 4 +--- env/ubi.c | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-)
env/eeprom.c +1 -1
@@ -175,5 +175,5 @@ U_BOOT_ENV_LOCATION(eeprom) = { .location = ENVL_EEPROM, ENV_NAME("EEPROM") .load = env_eeprom_load, - .save = env_save_ptr(env_eeprom_save), + .save = ENV_SAVE_PTR(env_eeprom_save), };
env/nvram.c +1 -1
@@ -65,6 +65,6 @@ U_BOOT_ENV_LOCATION(nvram) = { .location = ENVL_NVRAM,ENV_NAME ("NVRAM" ) .load = env_nvram_load, - .save = env_save_ptr(env_nvram_save), + .save = ENV_SAVE_PTR(env_nvram_save), .init = env_nvram_init, };
env/onenand.c +1 -1
@@ -107,5 +107,5 @@ U_BOOT_ENV_LOCATION(onenand) = { .location = ENVL_ONENAND, ENV_NAME("OneNAND") .load = env_onenand_load, - .save = env_save_ptr(env_onenand_save), + .save = ENV_SAVE_PTR(env_onenand_save), };
env/remote.c +1 -1
@@ -56,6 +56,6 @@ U_BOOT_ENV_LOCATION(remote) = { .location = ENVL_REMOTE,ENV_NAME ("Remote" ) .load = env_remote_load, - .save = env_save_ptr(env_remote_save), + .save = ENV_SAVE_PTR(env_remote_save), .init = env_remote_init, };
env/scsi.c +1 -3
@@ -108,8 +108,6 @@ U_BOOT_ENV_LOCATION(scsi) = { .location = ENVL_SCSI,ENV_NAME ("SCSI" ) .load = env_scsi_load, -#if defined(CONFIG_CMD_SAVEENV ) && !defined(CONFIG_XPL_BUILD ) - .save = env_save_ptr(env_scsi_save), + .save = ENV_SAVE_PTR(env_scsi_save), .erase = ENV_ERASE_PTR(env_scsi_erase), -#endif };
env/ubi.c +1 -1
@@ -219,6 +219,6 @@ U_BOOT_ENV_LOCATION(ubi) = { .location = ENVL_UBI,ENV_NAME ("UBI" ) .load = env_ubi_load, - .save = env_save_ptr(env_ubi_save), + .save = ENV_SAVE_PTR(env_ubi_save), .erase = ENV_ERASE_PTR(env_ubi_erase), };
Signature · 1 line
2.43.0
PATCH v2 1/2 env: Make more use of the ENV_SAVE_PTR macro
With commit 82b2f4135719 ("env_internal.h: add alternative ENV_SAVE_PTR macro") we introduced the ENV_SAVE_PTR macro but as explained in the commit message, left full conversion for a later time. This commit makes more progress on that front by doing the remaining easy conversions to the new macro.
Changes in v2:
- Reduce the number of conversions, some didn't work as expected once CMD_SAVEENV was actually disabled.
- Finish converting UBI
Cc Rasmus Villemoes <[email protected]>
--- env/eeprom.c | 2 +- env/nvram.c | 2 +- env/onenand.c | 2 +- env/scsi.c | 4 +--- env/ubi.c | 4 +--- 5 files changed, 5 insertions(+), 9 deletions(-)
env/eeprom.c +1 -1
@@ -175,5 +175,5 @@ U_BOOT_ENV_LOCATION(eeprom) = { .location = ENVL_EEPROM, ENV_NAME("EEPROM") .load = env_eeprom_load, - .save = env_save_ptr(env_eeprom_save), + .save = ENV_SAVE_PTR(env_eeprom_save), };
env/nvram.c +1 -1
@@ -65,6 +65,6 @@ U_BOOT_ENV_LOCATION(nvram) = { .location = ENVL_NVRAM,ENV_NAME ("NVRAM" ) .load = env_nvram_load, - .save = env_save_ptr(env_nvram_save), + .save = ENV_SAVE_PTR(env_nvram_save), .init = env_nvram_init, };
env/onenand.c +1 -1
@@ -107,5 +107,5 @@ U_BOOT_ENV_LOCATION(onenand) = { .location = ENVL_ONENAND, ENV_NAME("OneNAND") .load = env_onenand_load, - .save = env_save_ptr(env_onenand_save), + .save = ENV_SAVE_PTR(env_onenand_save), };
env/scsi.c +1 -3
@@ -108,8 +108,6 @@ U_BOOT_ENV_LOCATION(scsi) = { .location = ENVL_SCSI,ENV_NAME ("SCSI" ) .load = env_scsi_load, -#if defined(CONFIG_CMD_SAVEENV ) && !defined(CONFIG_XPL_BUILD ) - .save = env_save_ptr(env_scsi_save), + .save = ENV_SAVE_PTR(env_scsi_save), .erase = ENV_ERASE_PTR(env_scsi_erase), -#endif };
env/ubi.c +1 -3
@@ -33,7 +33,6 @@ DECLARE_GLOBAL_DATA_PTR;#define ENV_UBI_VOLUME_REDUND "invalid"#endif -#ifdef CONFIG_CMD_SAVEENV#ifdef CONFIG_ENV_REDUNDANT static int env_ubi_save (void ) {
@@ -103,7 +102,6 @@ static int env_ubi_save(void) return 0; }#endif /* CONFIG_ENV_REDUNDANT */ -#endif /* CONFIG_CMD_SAVEENV */ #ifdef CONFIG_ENV_REDUNDANT static int env_ubi_load (void )
@@ -219,6 +217,6 @@ U_BOOT_ENV_LOCATION(ubi) = { .location = ENVL_UBI,ENV_NAME ("UBI" ) .load = env_ubi_load, - .save = env_save_ptr(env_ubi_save), + .save = ENV_SAVE_PTR(env_ubi_save), .erase = ENV_ERASE_PTR(env_ubi_erase), };
Signature · 1 line
2.43.0
PATCH v2 2/2 env: remote: Disallow CMD_SAVEENV
Looking at how the saveenv portion of this driver was implemented, it does not appear that it could actually result in changes being saved on the remote end. Update Kconfig to disallow CMD_SAVEENV for ENV_IS_IN_REMOTE and then remove the relevant code.
---
Changes in v2:
- New patch
--- cmd/Kconfig | 1 + env/remote.c | 13 ------------- 2 files changed, 1 insertion(+), 13 deletions(-)
cmd/Kconfig +1 -0
@@ -717,6 +717,7 @@ config CMD_GREPENV config CMD_SAVEENV bool "saveenv" + depends on !(SRIO_PCIE_BOOT_SLAVE && ENV_IS_IN_REMOTE) default y help Save all environment variables into the compiled-in persistent
env/remote.c +0 -13
@@ -31,18 +31,6 @@ static int env_remote_init(void)return -ENOENT ; } -#ifdef CONFIG_CMD_SAVEENV -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" ); -return 1 ; -#else -return 0 ; -#endif -} -#endif /* CONFIG_CMD_SAVEENV */ -static int env_remote_load (void ) {#ifndef ENV_IS_EMBEDDED
@@ -56,6 +44,5 @@ U_BOOT_ENV_LOCATION(remote) = { .location = ENVL_REMOTE, ENV_NAME("Remote") .load = env_remote_load, - .save = env_save_ptr(env_remote_save), .init = env_remote_init, };
Signature · 1 line
2.43.0
Quoted 9 lines · Tom Rini
With commit
82b2f4135719("env_internal.h: add alternativeENV_SAVE_PTRmacro") we introduced theENV_SAVE_PTRmacro but as explained in the commit message, left full conversion for a later time. This commit makes more progress on that front by doing the remaining easy conversions to the new macro.Signed-off-by Tom Rini <[email protected]>[...]
Applied to u-boot/master, thanks!
[1/2] env: Make more use of the ENV_SAVE_PTR macro
commit: 8af4e124875932567cea627e04f26cf5cc529e25
[2/2] env: remote: Disallow CMD_SAVEENV
commit: 67e72e9686e702b85c38f62e4fc02f8efe3ffe82Signature · 1 line
Tom