summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMatthias Fuchs <matthias.fuchs@esd-electronics.com>2007-09-11 17:04:00 +0200
committerWolfgang Denk <wd@denx.de>2007-09-15 21:38:38 +0200
commit5bd7fe9aeb76906371f40b8fd07613f10922e3e7 (patch)
tree017950cd8c366e46f23b2f9253d470f40ce1b61a /drivers
parentc750d2e6692a000a82f29de7bf24e3dc21239161 (diff)
downloadu-boot-imx-5bd7fe9aeb76906371f40b8fd07613f10922e3e7.zip
u-boot-imx-5bd7fe9aeb76906371f40b8fd07613f10922e3e7.tar.gz
u-boot-imx-5bd7fe9aeb76906371f40b8fd07613f10922e3e7.tar.bz2
Fix do_div() usage in nand process output
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nand/nand_util.c21
1 files changed, 16 insertions, 5 deletions
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