Relax check for valid environment in __hwconfig
PATCH 1/1 Relax check for valid environment in __hwconfig
The function only needs env_get to be functional, so check the env_valid flag instead. There is no reason why this function should not work if environment is available early, say by being directly mapped in SPI.
--- common/hwconfig.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
common/hwconfig.c +2 -1
@@ -12,6 +12,7 @@#ifndef HWCONFIG_TEST #include <config.h> #include <common.h> +#include <environment.h> #include <exports.h> #include <hwconfig.h> #include <linux/types.h>
@@ -76,7 +77,7 @@ static const char *__hwconfig(const char *opt, size_t *arglen,/* if we are passed a buffer use it, otherwise try the environment */ if (!env_hwconfig) { -if (!(gd->flags &GD_FLG_ENV_READY )) { +if (gd->env_valid ==ENV_INVALID ) {printf ("WARNING: Calling __hwconfig without a buffer " "and before environment is ready\n" );return NULL ;
Signature · 1 line
2.15.1
PATCH 1/1 Relax check for valid environment in __hwconfig
Quoted 21 lines · Alexander Kabaev
The function only needs
env_getto be functional, so check theenv_validflag instead. There is no reason why this function should not work if environment is available early, say by being directly mapped in SPI.--- common/hwconfig.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)common/hwconfig.c +1
-0@@ -12,6 +12,7 @@#ifndef HWCONFIG_TEST #include <config.h> #include <common.h> +#include <environment.h> #include <exports.h> #include <hwconfig.h> #include <linux/types.h>
common/hwconfig.c static const char *__hwconfig(const char *opt, size_t *arglen, · line 83
Quoted 8 lines
common/hwconfig.c +1
-1@@ -76,7 +77,7 @@ static const char *__hwconfig(const char *opt, size_t *arglen,/* if we are passed a buffer use it, otherwise try the environment */ if (!env_hwconfig) { -if (!(gd->flags &GD_FLG_ENV_READY )) { +if (gd->env_valid ==ENV_INVALID ) {printf ("WARNING: Calling __hwconfig without a buffer " "and before environment is ready\n" );return NULL ;
Since you're changing the check here, please change the printf as well to match the new check. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180111/2b52a7ff/attachment.sig>