* [PATCH] env: Make more use of the ENV_SAVE_PTR macro
@ 2026-03-20 20:53 Tom Rini
2026-03-23 19:51 ` [PATCH v2 1/2] " Tom Rini
0 siblings, 1 reply; 4+ messages in thread
From: Tom Rini @ 2026-03-20 20:53 UTC (permalink / raw)
To: u-boot
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>
---
Cc Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
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(-)
diff --git a/env/eeprom.c b/env/eeprom.c
index b290b1013e1c..f4cc29093768 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -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),
};
diff --git a/env/nvram.c b/env/nvram.c
index d49cd0f337a0..18f0a0aa1fbf 100644
--- a/env/nvram.c
+++ b/env/nvram.c
@@ -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,
};
diff --git a/env/onenand.c b/env/onenand.c
index 8c349ef5ce6c..59b523e06c63 100644
--- a/env/onenand.c
+++ b/env/onenand.c
@@ -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),
};
diff --git a/env/remote.c b/env/remote.c
index 0cc383c23602..c8ade18c0b66 100644
--- a/env/remote.c
+++ b/env/remote.c
@@ -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,
};
diff --git a/env/scsi.c b/env/scsi.c
index 207717e17b16..e56891a98993 100644
--- a/env/scsi.c
+++ b/env/scsi.c
@@ -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
};
diff --git a/env/ubi.c b/env/ubi.c
index 59bd96feb488..347ff2346edf 100644
--- a/env/ubi.c
+++ b/env/ubi.c
@@ -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),
};
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] env: Make more use of the ENV_SAVE_PTR macro
2026-03-20 20:53 [PATCH] env: Make more use of the ENV_SAVE_PTR macro Tom Rini
@ 2026-03-23 19:51 ` Tom Rini
2026-03-23 19:51 ` [PATCH v2 2/2] env: remote: Disallow CMD_SAVEENV Tom Rini
2026-04-07 19:50 ` [PATCH v2 1/2] env: Make more use of the ENV_SAVE_PTR macro Tom Rini
0 siblings, 2 replies; 4+ messages in thread
From: Tom Rini @ 2026-03-23 19:51 UTC (permalink / raw)
To: u-boot
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 | 2 +-
env/nvram.c | 2 +-
env/onenand.c | 2 +-
env/scsi.c | 4 +---
env/ubi.c | 4 +---
5 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/env/eeprom.c b/env/eeprom.c
index b290b1013e1c..f4cc29093768 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -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),
};
diff --git a/env/nvram.c b/env/nvram.c
index d49cd0f337a0..18f0a0aa1fbf 100644
--- a/env/nvram.c
+++ b/env/nvram.c
@@ -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,
};
diff --git a/env/onenand.c b/env/onenand.c
index 8c349ef5ce6c..59b523e06c63 100644
--- a/env/onenand.c
+++ b/env/onenand.c
@@ -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),
};
diff --git a/env/scsi.c b/env/scsi.c
index 207717e17b16..e56891a98993 100644
--- a/env/scsi.c
+++ b/env/scsi.c
@@ -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
};
diff --git a/env/ubi.c b/env/ubi.c
index 59bd96feb488..e9865b45ebc6 100644
--- 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),
};
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] env: remote: Disallow CMD_SAVEENV
2026-03-23 19:51 ` [PATCH v2 1/2] " Tom Rini
@ 2026-03-23 19:51 ` Tom Rini
2026-04-07 19:50 ` [PATCH v2 1/2] env: Make more use of the ENV_SAVE_PTR macro Tom Rini
1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2026-03-23 19:51 UTC (permalink / raw)
To: u-boot; +Cc: Shengzhou Liu, Rasmus Villemoes
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.
Signed-off-by: Tom Rini <trini@konsulko.com>
---
Changes in v2:
- New patch
Cc: Shengzhou Liu <Shengzhou.Liu@nxp.com>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
cmd/Kconfig | 1 +
env/remote.c | 13 -------------
2 files changed, 1 insertion(+), 13 deletions(-)
diff --git a/cmd/Kconfig b/cmd/Kconfig
index bf47b440756c..24dc7fa54273 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -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
diff --git a/env/remote.c b/env/remote.c
index 0cc383c23602..5dd929155a43 100644
--- a/env/remote.c
+++ b/env/remote.c
@@ -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,
};
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/2] env: Make more use of the ENV_SAVE_PTR macro
2026-03-23 19:51 ` [PATCH v2 1/2] " Tom Rini
2026-03-23 19:51 ` [PATCH v2 2/2] env: remote: Disallow CMD_SAVEENV Tom Rini
@ 2026-04-07 19:50 ` Tom Rini
1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2026-04-07 19:50 UTC (permalink / raw)
To: u-boot, Tom Rini
On Mon, 23 Mar 2026 13:51:05 -0600, Tom Rini wrote:
> 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>
>
> [...]
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: 67e72e9686e702b85c38f62e4fc02f8efe3ffe82
--
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-07 19:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 20:53 [PATCH] env: Make more use of the ENV_SAVE_PTR macro Tom Rini
2026-03-23 19:51 ` [PATCH v2 1/2] " Tom Rini
2026-03-23 19:51 ` [PATCH v2 2/2] env: remote: Disallow CMD_SAVEENV Tom Rini
2026-04-07 19:50 ` [PATCH v2 1/2] env: Make more use of the ENV_SAVE_PTR macro Tom Rini
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.