Allow boards and architectures to override the default environment lookup code by overriding env_get_location.
Reviewed-by: Andre Przywara <andre.przyw...@arm.com> Reviewed-by: Lukasz Majewski <lu...@denx.de> Signed-off-by: Maxime Ripard <maxime.rip...@free-electrons.com> --- env/env.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/env/env.c b/env/env.c index 75da2b921804..6d0ab8ebe1a4 100644 --- a/env/env.c +++ b/env/env.c @@ -79,7 +79,25 @@ static void env_set_inited(enum env_location location) static enum env_location env_load_location; -static enum env_location env_get_location(enum env_operation op, int prio) +/** + * env_get_location() - Returns the best env location for a board + * @op: operations performed on the environment + * @prio: priority between the multiple environments, 0 being the + * highest priority + * + * This will return the preferred environment for the given + * priority. This is overridable by boards if they need to. + * + * All implementations are free to use the operation, the priority and + * any other data relevant to their choice, but must take into account + * the fact that the lowest prority (0) is the most important location + * in the system. The following locations should be returned by order + * of descending priorities, from the highest to the lowest priority. + * + * Returns: + * an enum env_location value on success, a negative error code otherwise + */ +__weak enum env_location env_get_location(enum env_operation op, int prio) { switch (op) { case ENVOP_GET_CHAR: -- git-series 0.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot