From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd_mem: Decode the mtest start and end values from fdt
Date: Fri, 01 Mar 2013 17:06:48 +0100 [thread overview]
Message-ID: <20130301160648.CD661200527@gemini.denx.de> (raw)
In-Reply-To: <10597224-d520-4a3f-8185-5de018ee5046@TX2EHSMHS026.ehs.local>
Dear Jagannadha Sutradharudu Teki,
In message <10597224-d520-4a3f-8185-5de018ee5046@TX2EHSMHS026.ehs.local> you wrote:
> This patch provides a support to decode the mtest start
> and end values from fdt config node.
>
> Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
> Tested-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
> ---
> common/cmd_mem.c | 6 ++++--
> common/main.c | 18 ++++++++++++++++++
> 2 files changed, 22 insertions(+), 2 deletions(-)
You are adding code here which may bot be user and/or wanted by the
majority of boards, so please make it configureable (and document the
new config option).
Also, your patchj is actually doing more than you describe in the
subject:
> - start = (ulong *)CONFIG_SYS_MEMTEST_START;
> + start = (ulong *)getenv_ulong("mteststart", 16,
> + CONFIG_SYS_MEMTEST_START);
>
> if (argc > 2)
> end = (ulong *)simple_strtoul(argv[2], NULL, 16);
> else
> - end = (ulong *)(CONFIG_SYS_MEMTEST_END);
> + end = (ulong *)getenv_ulong("mtestend", 16,
> + CONFIG_SYS_MEMTEST_END);
Here you are switching to use environment variablkes, which is NOT
mentioned in the commit message. Actually this should be in a
separate patch, and it also should be configurable.
> +static void process_fdt_mem_options(const void *blob)
> +{
> + ulong addr;
> +
> + /* Add an env variable to point to a mtest start, if available */
> + addr = fdtdec_get_config_int(gd->fdt_blob, "mtest-start", 0);
> + if (addr)
> + setenv_addr("mteststart", (void *)addr);
> +
> + /* Add an env variable to point to a mtest end, if available */
> + addr = fdtdec_get_config_int(gd->fdt_blob, "mtest-end", 0);
> + if (addr)
> + setenv_addr("mtestend", (void *)addr);
> +}
NAK. It is always wrong to mandatorily overwrite environment variable
that may have been set by the user.
If you really want to use enviuronment variables here (which I don't
think is a clever thing to do), then you need to be careful about
priorities: any user settings always have highest priority.
Note that you will shoot yourself in the foot because after a
"saveenv" any new, different values from a new device tree would be
ignored unless you manually delete these settings first.
As mentioned, this is not a good idea.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Irony is the gaiety of reflection and the joy of wisdom.
- Anatole France
next prev parent reply other threads:[~2013-03-01 16:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-01 14:32 [U-Boot] [PATCH] cmd_mem: Decode the mtest start and end values from fdt Jagannadha Sutradharudu Teki
2013-03-01 16:06 ` Wolfgang Denk [this message]
2013-03-01 19:15 ` Tom Rini
2013-03-01 19:24 ` Simon Glass
[not found] ` <ff1257d2-b332-477f-915d-0851e5ef944f@CO9EHSMHS030.ehs.local>
2013-03-01 22:48 ` Wolfgang Denk
[not found] ` <51f05678-4118-4be8-bb94-ad295c407602@DB3EHSMHS015.ehs.local>
2013-03-04 9:44 ` Wolfgang Denk
2013-03-08 19:08 ` [U-Boot] [PATCH] Feature Removal: disable "mtest" command by default Wolfgang Denk
2013-03-08 19:41 ` Ira W. Snyder
2013-03-08 20:50 ` Wolfgang Denk
2013-03-08 20:51 ` [U-Boot] [PATCH v2] " Wolfgang Denk
2013-03-11 19:57 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130301160648.CD661200527@gemini.denx.de \
--to=wd@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox