* [U-Boot] [PATCH] Relax check for valid environment in __hwconfig
@ 2018-01-10 20:42 Alexander Kabaev
2018-01-11 16:32 ` Tom Rini
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kabaev @ 2018-01-10 20:42 UTC (permalink / raw)
To: u-boot
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(-)
diff --git a/common/hwconfig.c b/common/hwconfig.c
index e5186d7796..4006aad59c 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -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;
--
2.15.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] Relax check for valid environment in __hwconfig
2018-01-10 20:42 [U-Boot] [PATCH] Relax check for valid environment in __hwconfig Alexander Kabaev
@ 2018-01-11 16:32 ` Tom Rini
0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2018-01-11 16:32 UTC (permalink / raw)
To: u-boot
On Wed, Jan 10, 2018 at 08:42:33PM +0000, Alexander Kabaev wrote:
> 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(-)
>
> diff --git a/common/hwconfig.c b/common/hwconfig.c
> index e5186d7796..4006aad59c 100644
> --- a/common/hwconfig.c
> +++ b/common/hwconfig.c
> @@ -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;
Since you're changing the check here, please change the printf as well
to match the new check. Thanks!
--
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-11 16:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-10 20:42 [U-Boot] [PATCH] Relax check for valid environment in __hwconfig Alexander Kabaev
2018-01-11 16:32 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox