
On Wed, Jan 17, 2018 at 03:03:40PM -0700, Simon Glass wrote:
Hi Maxime,
On 16 January 2018 at 01:16, Maxime Ripard maxime.ripard@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@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.
This was done in a later patch (the __weak one), but you're right that it makes more sense for it to be here.
{
if (prio >= 1)
return ENVL_UNKNOWN;
What is this for? Can you please add a comment?
Done, thanks! Maxime