diff mbox series

[V2,5/7] env: nowhere: Implement .load callback

Message ID 20200707185139.2225-5-marex@denx.de
State Superseded
Headers show
Series [V2,1/7] env: Warn on force access if ENV_ACCESS_IGNORE_FORCE set | expand

Commit Message

Marek Vasut July 7, 2020, 6:51 p.m. UTC
Add .load callback for the 'nowhere' environment driver. This is useful
for when the 'nowhere' driver is used in combination with other drivers
and should be used to load the default environment.

Signed-off-by: Marek Vasut <marex at denx.de>
---
V2: No change
---
 env/nowhere.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Tom Rini July 24, 2020, 2:56 p.m. UTC | #1
On Tue, Jul 07, 2020 at 08:51:37PM +0200, Marek Vasut wrote:

> Add .load callback for the 'nowhere' environment driver. This is useful

> for when the 'nowhere' driver is used in combination with other drivers

> and should be used to load the default environment.

> 

> Signed-off-by: Marek Vasut <marex@denx.de>


Reviewed-by: Tom Rini <trini@konsulko.com>


-- 
Tom
Tom Rini July 31, 2020, 9:39 p.m. UTC | #2
On Tue, Jul 07, 2020 at 08:51:37PM +0200, Marek Vasut wrote:

> Add .load callback for the 'nowhere' environment driver. This is useful

> for when the 'nowhere' driver is used in combination with other drivers

> and should be used to load the default environment.

> 

> Signed-off-by: Marek Vasut <marex@denx.de>

> Reviewed-by: Tom Rini <trini@konsulko.com>


I'm deferring this version for
http://patchwork.ozlabs.org/project/uboot/patch/20200728095128.2363-6-patrick.delaunay@st.com/
which address the problem of this change bringing in more code in SPL
otherwise.

-- 
Tom
diff mbox series

Patch

diff --git a/env/nowhere.c b/env/nowhere.c
index f5b0a17652..417a636f83 100644
--- a/env/nowhere.c
+++ b/env/nowhere.c
@@ -15,6 +15,12 @@ 
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static int env_nowhere_load(void)
+{
+	env_set_default(NULL, 0);
+
+	return 0;
+}
 /*
  * Because we only ever have the default environment available we must mark
  * it as invalid.
@@ -30,5 +36,6 @@  static int env_nowhere_init(void)
 U_BOOT_ENV_LOCATION(nowhere) = {
 	.location	= ENVL_NOWHERE,
 	.init		= env_nowhere_init,
+	.load		= env_nowhere_load,
 	ENV_NAME("nowhere")
 };