Commit 9c24dfb2b80cba73b79da36321eb23f47d4a9aa3

Authored by Maxime Ripard
Committed by Tom Rini
1 parent 748277c415

cmd: nvedit: Get rid of the env lookup

The nvedit command is the only user of env_driver_lookup_default outside of
the environment code itself, and it uses it only to print the environment
it's about to save to during env save.

As we're about to rework the environment to be able to handle multiple
environment sources, we might not have an idea of what environment backend
is going to be used before trying (and possibly failing for some).

Therefore, it makes sense to remove that message and move it to the
env_save function itself. As a side effect, we also can get rid of the call
to env_driver_lookup_default that is also about to get refactored.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Showing 3 changed files with 3 additions and 12 deletions Side-by-side Diff

... ... @@ -708,10 +708,6 @@
708 708 static int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc,
709 709 char * const argv[])
710 710 {
711   - struct env_driver *env = env_driver_lookup_default();
712   -
713   - printf("Saving Environment to %s...\n", env->name);
714   -
715 711 return env_save() ? 1 : 0;
716 712 }
717 713  
... ... @@ -54,7 +54,7 @@
54 54 return ENVL_UNKNOWN;
55 55 }
56 56  
57   -struct env_driver *env_driver_lookup_default(void)
  57 +static struct env_driver *env_driver_lookup_default(void)
58 58 {
59 59 enum env_location loc = env_get_default_location();
60 60 struct env_driver *drv;
... ... @@ -117,6 +117,8 @@
117 117 return -ENODEV;
118 118 if (!drv->save)
119 119 return -ENOSYS;
  120 +
  121 + printf("Saving Environment to %s...\n", drv->name);
120 122 ret = drv->save();
121 123 if (ret) {
122 124 debug("%s: Environment failed to save (err=%d)\n", __func__,
include/environment.h
... ... @@ -293,13 +293,6 @@
293 293 #endif
294 294  
295 295 /**
296   - * env_driver_lookup_default() - Look up the default environment driver
297   - *
298   - * @return pointer to driver, or NULL if none (which should not happen)
299   - */
300   -struct env_driver *env_driver_lookup_default(void);
301   -
302   -/**
303 296 * env_get_char() - Get a character from the early environment
304 297 *
305 298 * This reads from the pre-relocation environemnt