summaryrefslogtreecommitdiff
path: root/env/env.c
diff options
context:
space:
mode:
authorGoldschmidt Simon <sgoldschmidt@de.pepperl-fuchs.com>2018-02-09 20:23:17 +0000
committerTom Rini <trini@konsulko.com>2018-02-16 11:12:42 -0500
commitb2cdef4861befb65e784c01ed71a48bfb811ab38 (patch)
treebd8f5b467d2f09670e7167a2a66ceb95d8407347 /env/env.c
parente1caa5841e8a9bc0ee658bdacae0519fa28e1e6a (diff)
downloadu-boot-b2cdef4861befb65e784c01ed71a48bfb811ab38.tar.gz
env: restore old env_get_char() behaviour
With multiple environments, the 'get_char' callback for env drivers does not really make sense any more because it is only supported by two drivers (eeprom and nvram). To restore single character loading for these drivers, override 'env_get_char_spec'. Signed-off-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Diffstat (limited to 'env/env.c')
-rw-r--r--env/env.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/env/env.c b/env/env.c
index edfb575c0e..3795dbc24e 100644
--- a/env/env.c
+++ b/env/env.c
@@ -147,32 +147,17 @@ static struct env_driver *env_driver_lookup(enum env_operation op, int prio)
return drv;
}
-int env_get_char(int index)
+__weak int env_get_char_spec(int index)
{
- struct env_driver *drv;
- int prio;
+ return *(uchar *)(gd->env_addr + index);
+}
+int env_get_char(int index)
+{
if (gd->env_valid == ENV_INVALID)
return default_environment[index];
-
- for (prio = 0; (drv = env_driver_lookup(ENVOP_GET_CHAR, prio)); prio++) {
- int ret;
-
- if (!drv->get_char)
- continue;
-
- if (!env_has_inited(drv->location))
- continue;
-
- ret = drv->get_char(index);
- if (!ret)
- return 0;
-
- debug("%s: Environment %s failed to load (err=%d)\n", __func__,
- drv->name, ret);
- }
-
- return -ENODEV;
+ else
+ return env_get_char_spec(index);
}
int env_load(void)