From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Ripard Date: Thu, 18 Jan 2018 15:54:42 +0100 Subject: [U-Boot] [PATCH v2 03/15] env: Pass additional parameters to the env lookup function In-Reply-To: References: <4c663f0b6b4bd6f8c15f23527ff02d7e9eebb2ac.1516094113.git-series.maxime.ripard@free-electrons.com> Message-ID: <20180118145442.mtlg47w2v2c3n2wp@flea.lan> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Jan 17, 2018 at 03:03:40PM -0700, Simon Glass wrote: > Hi Maxime, > > On 16 January 2018 at 01:16, Maxime Ripard > 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 > > --- > > 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 -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: