[U-Boot] [PATCH v2 03/15] env: Pass additional parameters to the env lookup function

Simon Glass sjg at chromium.org
Wed Jan 17 22:03:40 UTC 2018


Hi Maxime,

On 16 January 2018 at 01:16, Maxime Ripard
<maxime.ripard at free-electrons.com> wrote:
> In preparation for the multiple environment support, let's introduce two
> new parameters to the environment driver lookup function: the priority and
> operation.
>
> The operation parameter is meant to identify, obviously, the operation you
> might want to perform on the environment.
>
> The priority is a number passed to identify the environment priority you
> want to retrieve. The lowest priority parameter (0) will be the primary
> source.
>
> Combining the two parameters allow you to support multiple environments
> through different priorities, and to change those priorities between read
> and writes operations.
>
> This is especially useful to implement migration mechanisms where you want
> to always use the same environment first, be it to read or write, while the
> common case is more likely to use the same environment it has read from to
> write it to.
>
> Signed-off-by: Maxime Ripard <maxime.ripard at free-electrons.com>
> ---
>  env/env.c             | 135 +++++++++++++++++++++++++++----------------
>  include/environment.h |   8 +++-
>  2 files changed, 94 insertions(+), 49 deletions(-)
>
> diff --git a/env/env.c b/env/env.c
> index 97ada5b5a6fd..4dc39b384c1e 100644
> --- a/env/env.c
> +++ b/env/env.c
> @@ -26,8 +26,11 @@ static struct env_driver *_env_driver_lookup(enum env_location loc)
>         return NULL;
>  }
>
> -static enum env_location env_get_location(void)
> +static enum env_location env_get_location(enum env_operation op, int prio)

Please add a function comment, including why @op is needed.

>  {
> +       if (prio >= 1)
> +               return ENVL_UNKNOWN;

What is this for? Can you please add a comment?

Regards,
Simon


More information about the U-Boot mailing list