]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
env: Make more use of the ENV_SAVE_PTR macro
authorTom Rini <trini@konsulko.com>
Mon, 23 Mar 2026 19:51:05 +0000 (13:51 -0600)
committerTom Rini <trini@konsulko.com>
Tue, 7 Apr 2026 17:30:41 +0000 (11:30 -0600)
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.

Signed-off-by: Tom Rini <trini@konsulko.com>
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 <rasmus.villemoes@prevas.dk>

env/eeprom.c
env/nvram.c
env/onenand.c
env/scsi.c
env/ubi.c

index b290b1013e1c71906772446c9981c76443238e81..f4cc2909376831e8cbdae2d6d59b565fe167f910 100644 (file)
@@ -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),
 };
index d49cd0f337a05d5700f20e6de54971f29f799683..18f0a0aa1fbf9615b020c70e236230160242dae0 100644 (file)
@@ -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,
 };
index 8c349ef5ce6cc0d92425bf97628c52c4962e0dc7..59b523e06c633f26c70e3954192136393018149d 100644 (file)
@@ -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),
 };
index 207717e17b160f2cc4403eeb69c2f0cc65723da7..e56891a98993da078163ac3da1bc223cd809a04c 100644 (file)
@@ -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
 };
index 59bd96feb488065e558daac3819a07683f4e2a64..e9865b45ebc6c5ef942ed8cc777ee4339c3567dc 100644 (file)
--- a/env/ubi.c
+++ b/env/ubi.c
@@ -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),
 };