From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Ripard Date: Wed, 7 Feb 2018 19:23:10 +0100 Subject: [U-Boot] [PATCH v3 09/15] env: Support multiple environments In-Reply-To: <1517993144.6070.90.camel@infinera.com> References: <844212451999302a41d87526d6616b1af7c781d1.1516723179.git-series.maxime.ripard@free-electrons.com> <64448a79-f856-0cd9-d9b2-a5e29b92d768@de.pepperl-fuchs.com> <1517905247.6070.60.camel@infinera.com> <563b6cc9-e021-3931-cdd3-e98b2e1ffa2b@de.pepperl-fuchs.com> <1517993144.6070.90.camel@infinera.com> Message-ID: <20180207182310.k5f5gsbmawmfxtcn@flea> 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, Feb 07, 2018 at 08:45:46AM +0000, Joakim Tjernlund wrote: > On Thu, 1970-01-01 at 00:00 +0000, Simon Goldschmidt wrote: > > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. > > > > > > On 06.02.2018 09:20, Joakim Tjernlund wrote: > > > On Thu, 1970-01-01 at 00:00 +0000, Simon Goldschmidt wrote: > > > > > > ..... > > > > > Reviewed-by: Andre Przywara > > > > > Reviewed-by: Simon Glass > > > > > Signed-off-by: Maxime Ripard > > > > > --- > > > > > env/env.c | 80 +++++++++++++++++++++++++++++++++++--------------------- > > > > > 1 file changed, 50 insertions(+), 30 deletions(-) > > > > > > > > > > diff --git a/env/env.c b/env/env.c > > > > > index 906f28ee50a1..1182fdb545db 100644 > > > > > --- a/env/env.c > > > > > +++ b/env/env.c > > > > > @@ -26,6 +26,41 @@ static struct env_driver *_env_driver_lookup(enum env_location loc) > > > > > return NULL; > > > > > } > > > > > > > > > > +static enum env_location env_locations[] = { > > > > > > Don't use static/global variables. They cause a lot of relocation work/size > > > and is less flexible. > > > > In this specific case, I think this array should be const anyway, would > > that prevent the relocation problems you see? > > > > > > There is no way to #define ENVL_EEPROM to a function > > > when a variable. > > > > ENVL_EEPROM is an enum value, why would you define it to a function? > > I got boards that very similar but differ in where/how env. is > stored, like different flash so I need to be able to select at > runtime how get my env., I haven't looked if this particular area is > affected but ideally I would like if all env. related "constants" > could be impl. with a function instead. It's exactly the point of this entire serie though, and why we merged it. You just need to override env_get_location in your board, and return the preferred location. Maxime -- Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: