* [U-Boot-Users] [PATCH][NAND] Fix do_div() usage in nand process output
@ 2007-09-11 15:04 Matthias Fuchs
2007-09-15 19:38 ` Wolfgang Denk
0 siblings, 1 reply; 2+ messages in thread
From: Matthias Fuchs @ 2007-09-11 15:04 UTC (permalink / raw)
To: u-boot
Fix usage of do_div() in nand erase|read|write process output.
The last patch to nand_util.c introduced do_div() instead of libgcc's
implementation. But do_div() returns the quotient in its first
macro parameter and not as result.
Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
---
commit 72ce73aff517363e9fc9fe3ce8c1b21e47ab8fe0
tree 4b241a66240bf37f48cf72c0dc0b19ec3d0d4803
parent 1d9e31e04911a6bb7cc66dd91132c699101c32e2
author Matthias Fuchs <matthias.fuchs@esd-electronics.com> Tue, 11 Sep 2007 16:52:29 +0200
committer Matthias Fuchs <matthias.fuchs@esd-electronics.com> Tue, 11 Sep 2007 16:52:29 +0200
common/cmd_nand.c | 2 +-
drivers/nand/nand_util.c | 21 ++++++++++++++++-----
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 254a775..34b522b 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -452,7 +452,7 @@ U_BOOT_CMD(nand, 5, 1, do_nand,
"info - show available NAND devices\n"
"nand device [dev] - show or set current device\n"
"nand read[.jffs2] - addr off|partition size\n"
- "nand write[.jffs2] - addr off|partiton size - read/write `size' bytes starting\n"
+ "nand write[.jffs2] - addr off|partition size - read/write `size' bytes starting\n"
" at offset `off' to/from memory address `addr'\n"
"nand erase [clean] [off size] - erase `size' bytes from\n"
" offset `off' (entire device if not specified)\n"
diff --git a/drivers/nand/nand_util.c b/drivers/nand/nand_util.c
index cf05043..4fd4e16 100644
--- a/drivers/nand/nand_util.c
+++ b/drivers/nand/nand_util.c
@@ -210,9 +210,12 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
if (!opts->quiet) {
unsigned long long n =(unsigned long long)
- (erase.addr+meminfo->erasesize-opts->offset)
- * 100;
- int percent = (int)do_div(n, erase_length);
+ (erase.addr + meminfo->erasesize - opts->offset)
+ * 100;
+ int percent;
+
+ do_div(n, erase_length);
+ percent = (int)n;
/* output progress message only at whole percent
* steps to reduce the number of messages printed
@@ -478,7 +481,11 @@ int nand_write_opts(nand_info_t *meminfo, const nand_write_options_t *opts)
if (!opts->quiet) {
unsigned long long n = (unsigned long long)
(opts->length-imglen) * 100;
- int percent = (int)do_div(n, opts->length);
+ int percent;
+
+ do_div(n, opts->length);
+ percent = (int)n;
+
/* output progress message only at whole percent
* steps to reduce the number of messages printed
* on (slow) serial consoles
@@ -653,7 +660,11 @@ int nand_read_opts(nand_info_t *meminfo, const nand_read_options_t *opts)
if (!opts->quiet) {
unsigned long long n = (unsigned long long)
(opts->length-imglen) * 100;
- int percent = (int)do_div(n ,opts->length);
+ int percent;
+
+ do_div(n, opts->length);
+ percent = (int)n;
+
/* output progress message only at whole percent
* steps to reduce the number of messages printed
* on (slow) serial consoles
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot-Users] [PATCH][NAND] Fix do_div() usage in nand process output
2007-09-11 15:04 [U-Boot-Users] [PATCH][NAND] Fix do_div() usage in nand process output Matthias Fuchs
@ 2007-09-15 19:38 ` Wolfgang Denk
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2007-09-15 19:38 UTC (permalink / raw)
To: u-boot
In message <200709111704.01191.matthias.fuchs@esd-electronics.com> you wrote:
> Fix usage of do_div() in nand erase|read|write process output.
>
> The last patch to nand_util.c introduced do_div() instead of libgcc's
> implementation. But do_div() returns the quotient in its first
> macro parameter and not as result.
Applied, thanks.
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
Q: How many DEC repairman does it take to fix a flat ?
A: Five; four to hold the car up and one to swap tires.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-09-15 19:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-11 15:04 [U-Boot-Users] [PATCH][NAND] Fix do_div() usage in nand process output Matthias Fuchs
2007-09-15 19:38 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox