Skip to content
Snippets Groups Projects
Commit 3a6d56c2 authored by Dirk Behme's avatar Dirk Behme Committed by Wolfgang Denk
Browse files

Make use of generic 64bit division in nand_util.c


Use generic 64bit division in nand_util.c. This makes nand_util.c
independent of any toolchain 64bit division.

Signed-off-by: default avatarDirk Behme <dirk.behme@gmail.com>
parent f7c086e9
No related branches found
No related tags found
No related merge requests found
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <command.h> #include <command.h>
#include <watchdog.h> #include <watchdog.h>
#include <malloc.h> #include <malloc.h>
#include <div64.h>
#include <nand.h> #include <nand.h>
#include <jffs2/jffs2.h> #include <jffs2/jffs2.h>
...@@ -208,10 +209,10 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts) ...@@ -208,10 +209,10 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
} }
if (!opts->quiet) { if (!opts->quiet) {
int percent = (int) unsigned long long n =(unsigned long long)
((unsigned long long)
(erase.addr+meminfo->erasesize-opts->offset) (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 /* output progress message only at whole percent
* steps to reduce the number of messages printed * 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) ...@@ -475,10 +476,9 @@ int nand_write_opts(nand_info_t *meminfo, const nand_write_options_t *opts)
imglen -= readlen; imglen -= readlen;
if (!opts->quiet) { if (!opts->quiet) {
int percent = (int) unsigned long long n = (unsigned long long)
((unsigned long long) (opts->length-imglen) * 100;
(opts->length-imglen) * 100 int percent = (int)do_div(n, opts->length);
/ opts->length);
/* output progress message only at whole percent /* output progress message only at whole percent
* steps to reduce the number of messages printed * steps to reduce the number of messages printed
* on (slow) serial consoles * on (slow) serial consoles
...@@ -651,10 +651,9 @@ int nand_read_opts(nand_info_t *meminfo, const nand_read_options_t *opts) ...@@ -651,10 +651,9 @@ int nand_read_opts(nand_info_t *meminfo, const nand_read_options_t *opts)
} }
if (!opts->quiet) { if (!opts->quiet) {
int percent = (int) unsigned long long n = (unsigned long long)
((unsigned long long) (opts->length-imglen) * 100;
(opts->length-imglen) * 100 int percent = (int)do_div(n ,opts->length);
/ opts->length);
/* output progress message only at whole percent /* output progress message only at whole percent
* steps to reduce the number of messages printed * steps to reduce the number of messages printed
* on (slow) serial consoles * on (slow) serial consoles
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment