From: Franck Jullien <franck.jullien@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH] cfi_flash: show progress while during erase
Date: Mon, 26 May 2014 20:12:32 +0200 [thread overview]
Message-ID: <1401127952-10811-1-git-send-email-franck.jullien@gmail.com> (raw)
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
---
drivers/mtd/nor/cfi_flash.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nor/cfi_flash.c b/drivers/mtd/nor/cfi_flash.c
index 3d3d231..f2f52e1 100644
--- a/drivers/mtd/nor/cfi_flash.c
+++ b/drivers/mtd/nor/cfi_flash.c
@@ -470,7 +470,7 @@ flash_sect_t find_sector (struct flash_info *info, ulong addr)
return sector;
}
-static int cfi_erase(struct flash_info *finfo, size_t count, loff_t offset)
+static int cfi_erase(struct flash_info *finfo, size_t count, loff_t offset, int verbose)
{
unsigned long start, end;
int i, ret = 0;
@@ -481,17 +481,25 @@ static int cfi_erase(struct flash_info *finfo, size_t count, loff_t offset)
end = find_sector(finfo, (unsigned long)finfo->base + offset +
count - 1);
+ if (verbose)
+ init_progression_bar(end - start);
+
for (i = start; i <= end; i++) {
ret = finfo->cfi_cmd_set->flash_erase_one(finfo, i);
if (ret)
goto out;
+ if (verbose)
+ show_progress(i - start);
+
if (ctrlc()) {
ret = -EINTR;
goto out;
}
}
out:
+ if (verbose)
+ putchar('\n');
return ret;
}
@@ -933,7 +941,7 @@ static int cfi_mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
struct flash_info *info = container_of(mtd, struct flash_info, mtd);
int ret;
- ret = cfi_erase(info, instr->len, instr->addr);
+ ret = cfi_erase(info, instr->len, instr->addr, 1);
if (ret) {
instr->state = MTD_ERASE_FAILED;
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2014-05-26 18:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-26 18:12 Franck Jullien [this message]
2014-05-26 18:20 ` Franck Jullien
2014-05-27 5:42 ` Sascha Hauer
2014-05-27 6:50 ` Franck Jullien
2014-05-27 18:24 ` Sascha Hauer
2014-05-26 19:04 ` Holger Schurig
2014-05-26 19:12 ` Franck Jullien
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=1401127952-10811-1-git-send-email-franck.jullien@gmail.com \
--to=franck.jullien@gmail.com \
--cc=barebox@lists.infradead.org \
/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