diff options
| author | Gerald Van Baren <vanbaren@cideas.com> | 2007-08-10 19:19:50 -0400 |
|---|---|---|
| committer | Gerald Van Baren <vanbaren@cideas.com> | 2007-08-10 19:19:50 -0400 |
| commit | 29eaae953476f2bba4d5c7ac097b96cd827c1dff (patch) | |
| tree | 537faa4c04db58ee7b070b56bd7de7bd116092d3 /drivers/nand/nand_util.c | |
| parent | ed8e5f362a2fc572eb9c1854f6c76c291b0f9a0f (diff) | |
| parent | fb56579ffe7ef3275b7036bb7b924e5a0d32bd70 (diff) | |
| download | olio-uboot-2014.01-29eaae953476f2bba4d5c7ac097b96cd827c1dff.tar.xz olio-uboot-2014.01-29eaae953476f2bba4d5c7ac097b96cd827c1dff.zip | |
Merge git://www.denx.de/git/u-boot
Diffstat (limited to 'drivers/nand/nand_util.c')
| -rw-r--r-- | drivers/nand/nand_util.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/nand/nand_util.c b/drivers/nand/nand_util.c index 88c1df6c2..aee872703 100644 --- a/drivers/nand/nand_util.c +++ b/drivers/nand/nand_util.c @@ -37,6 +37,7 @@ #include <command.h> #include <watchdog.h> #include <malloc.h> +#include <div64.h> #include <nand.h> #include <jffs2/jffs2.h> @@ -208,10 +209,10 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts) } if (!opts->quiet) { - int percent = (int) - ((unsigned long long) + unsigned long long n =(unsigned long long) (erase.addr+meminfo->erasesize-opts->offset) - * 100 / erase_length); + * 100; + int percent = (int)do_div(n, erase_length); /* output progress message only at whole percent * steps to reduce the number of messages printed @@ -475,10 +476,9 @@ int nand_write_opts(nand_info_t *meminfo, const nand_write_options_t *opts) imglen -= readlen; if (!opts->quiet) { - int percent = (int) - ((unsigned long long) - (opts->length-imglen) * 100 - / opts->length); + unsigned long long n = (unsigned long long) + (opts->length-imglen) * 100; + int percent = (int)do_div(n, opts->length); /* output progress message only at whole percent * steps to reduce the number of messages printed * on (slow) serial consoles @@ -651,10 +651,9 @@ int nand_read_opts(nand_info_t *meminfo, const nand_read_options_t *opts) } if (!opts->quiet) { - int percent = (int) - ((unsigned long long) - (opts->length-imglen) * 100 - / opts->length); + unsigned long long n = (unsigned long long) + (opts->length-imglen) * 100; + int percent = (int)do_div(n ,opts->length); /* output progress message only at whole percent * steps to reduce the number of messages printed * on (slow) serial consoles |