From: Detlev Zundel <dzu@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/5] NAND: Add scrub.quiet command option
Date: Fri, 09 Sep 2011 17:39:07 +0200 [thread overview]
Message-ID: <m2vct17mjo.fsf@ohwell.denx.de> (raw)
In-Reply-To: <1315514380-19089-6-git-send-email-marek.vasut@gmail.com> (Marek Vasut's message of "Thu, 8 Sep 2011 22:39:40 +0200")
Hi Marek,
> This allows the scrub command to scrub without asking the user if he really
> wants to scrub the area. Useful in scripts.
>
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> Cc: Scott Wood <scottwood@freescale.com>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Detlev Zundel <dzu@denx.de>
> ---
> common/cmd_nand.c | 14 +++++++++++++-
> 1 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/common/cmd_nand.c b/common/cmd_nand.c
> index 5b7e83d..45179e9 100644
> --- a/common/cmd_nand.c
> +++ b/common/cmd_nand.c
> @@ -502,11 +502,19 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
> int clean = argc > 2 && !strcmp("clean", argv[2]);
> int o = clean ? 3 : 2;
> int scrub = !strncmp(cmd, "scrub", 5);
> + int scrub_quiet = !strncmp(cmd, "scrub.quiet", 11);
> int part = 0;
> int chip = 0;
> int spread = 0;
> int args = 2;
>
> + /*
> + * Quiet scrub is a special option only for the scrub command,
> + * ignore it in the following construction.
> + */
> + if (scrub_quiet)
> + cmd[5] = 0;
> +
This is _really_ hackish and makes an effort not to fit into the coding
style at hand. Please use the available code and extend the construct
below to match the ".quiet" suffix. It is not that different.
> if (cmd[5] != 0) {
> if (!strcmp(&cmd[5], ".spread")) {
> spread = 1;
> @@ -543,7 +551,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
> opts.quiet = quiet;
> opts.spread = spread;
>
> - if (scrub) {
> + if (scrub && !scrub_quiet) {
> puts("Warning: "
> "scrub option will erase all factory set "
> "bad blocks!\n"
> @@ -569,6 +577,10 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
> return -1;
> }
> }
> +
> + if (scrub_quiet)
> + opts.scrub = 1;
> +
Urgh. Please turn this into
if (scrub) {
if (!scrub_quiet) {
} else {
}
}
Cheers
Detlev
--
In the topologic hell the beer is packed in Klein's bottles.
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
next prev parent reply other threads:[~2011-09-09 15:39 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-08 20:39 [U-Boot] [PATCH 0/5] Random NAND fixes and improvements Marek Vasut
2011-09-08 20:39 ` [U-Boot] [PATCH 1/5] NAND: Really ignore bad blocks when scrubbing Marek Vasut
2011-09-08 20:39 ` [U-Boot] [PATCH 2/5] NAND: Add nand read.raw and write.raw commands Marek Vasut
2011-09-08 20:39 ` [U-Boot] [PATCH 3/5] NAND: Allow per-buffer allocation Marek Vasut
2011-09-08 20:39 ` [U-Boot] [PATCH 4/5] NAND: Make page, erase, oob size available via cmd_nand Marek Vasut
2011-09-08 20:39 ` [U-Boot] [PATCH 5/5] NAND: Add scrub.quiet command option Marek Vasut
2011-09-09 15:39 ` Detlev Zundel [this message]
2011-09-10 20:54 ` Marek Vasut
2011-09-12 9:49 ` Detlev Zundel
-- strict thread matches above, loose matches on Subject: below --
2011-09-12 4:04 [U-Boot] [PATCH 0/5 V2] Random NAND fixes and improvements Marek Vasut
2011-09-12 4:04 ` [U-Boot] [PATCH 5/5] NAND: Add scrub.quiet command option Marek Vasut
2011-09-12 16:45 ` Mike Frysinger
2011-09-12 17:45 ` Marek Vasut
2011-09-12 18:06 ` Scott Wood
2011-09-12 18:24 ` Marek Vasut
2011-09-12 18:31 ` Scott Wood
2011-09-12 18:36 ` Marek Vasut
2011-09-12 19:19 ` Scott Wood
2011-09-12 19:28 ` Marek Vasut
2011-09-12 19:36 ` Scott Wood
2011-09-12 19:42 ` Marek Vasut
2011-09-12 23:24 ` Scott Wood
2011-09-13 1:02 ` Marek Vasut
2011-09-13 4:25 ` Wolfgang Denk
2011-09-13 4:36 ` Marek Vasut
2011-09-13 22:22 ` Scott Wood
2011-09-13 22:41 ` Marek Vasut
2011-09-13 22:53 ` Scott Wood
2011-09-12 18:37 ` Wolfgang Denk
2011-09-12 18:50 ` Marek Vasut
2011-09-12 20:33 ` Mike Frysinger
2011-09-12 22:59 ` Marek Vasut
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=m2vct17mjo.fsf@ohwell.denx.de \
--to=dzu@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