[PATCH 3/5] m25p80: progressbar tweak

Johannes Stezenbach js at sig21.net
Wed Jun 6 12:04:58 EDT 2012


Show progressbar even when erasing just a single sector,
otherwise it looks as if erase didn't do anything.

Signed-off-by: Johannes Stezenbach <js at sig21.net>
---
 drivers/nor/m25p80.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nor/m25p80.c b/drivers/nor/m25p80.c
index 86e6d25..77669c2 100644
--- a/drivers/nor/m25p80.c
+++ b/drivers/nor/m25p80.c
@@ -214,7 +214,7 @@ static ssize_t m25p80_erase(struct cdev *cdev, size_t count, unsigned long offse
 
 	start_sector = offset / flash->erasesize;
 	end_sector = (offset + count - 1) / flash->erasesize;
-	init_progression_bar(end_sector - start_sector);
+	init_progression_bar(end_sector - start_sector + 1);
 
 	/* whole-chip erase? */
 	if (len == flash->size) {
@@ -237,11 +237,11 @@ static ssize_t m25p80_erase(struct cdev *cdev, size_t count, unsigned long offse
 			if (erase_sector(flash, addr))
 				return -EIO;
 
+			show_progress(++progress);
 			if (len <= flash->erasesize)
 				break;
 			addr += flash->erasesize;
 			len -= flash->erasesize;
-			show_progress(progress++);
 		}
 	}
 
-- 
1.7.10




More information about the barebox mailing list