From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Wed, 26 Jul 2017 12:04:53 -0400 Subject: [U-Boot] [PATCH v2 22/34] env: Add a new implementation of environment access In-Reply-To: <20170724032009.43994-23-sjg@chromium.org> References: <20170724032009.43994-1-sjg@chromium.org> <20170724032009.43994-23-sjg@chromium.org> Message-ID: <20170726160453.GH26163@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sun, Jul 23, 2017 at 09:19:57PM -0600, Simon Glass wrote: > We plan to move to a environment access via drivers for each location > where the environment can be stored. Add an implementation for this. So > far it is not used, but will be pressed into service in a future patch. > > Signed-off-by: Simon Glass [snip] > +static enum env_location env_get_default_location(void) > +{ > + if IS_ENABLED(CONFIG_ENV_IS_IN_DATAFLASH) > + return ENVL_DATAFLASH; > + else if IS_ENABLED(CONFIG_ENV_IS_IN_EEPROM) > + return ENVL_EEPROM; > + else if IS_ENABLED(CONFIG_ENV_IS_IN_FAT) > + return ENVL_FAT; > + else if IS_ENABLED(CONFIG_ENV_IS_IN_FLASH) > + return ENVL_FLASH; > + else if IS_ENABLED(CONFIG_ENV_IS_IN_MMC) > + return ENVL_MMC; > + else if IS_ENABLED(CONFIG_ENV_IS_IN_NAND) > + return ENVL_NAND; > + else if IS_ENABLED(CONFIG_ENV_IS_IN_NVRAM) > + return ENVL_NVRAM; > + else if IS_ENABLED(CONFIG_ENV_IS_IN_REMOTE) > + return ENVL_REMOTE; > + else if IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH) > + return ENVL_SPI_FLASH; > + else if IS_ENABLED(CONFIG_ENV_IS_IN_UBI) > + return ENVL_UBI; > + else if IS_ENABLED(CONFIG_ENV_IS_NOWHERE) > + return ENVL_NOWHERE; > + else > + return ENVL_UNKNOWN; > +} I think the kernel has a few examples of how the Kconfig side of things looks so that you can offer N options and then pick a default one (io scheduler, etc). We should do that rather than alphabetical IS_ENABLED tests. Otherwise, TODOs aside, looks good. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: