Patchwork [2/5] Refine messages of SPI block protection disables.

login
register
about
Submitter Stefan Tauner
Date 2012-02-15 01:10:21
Message ID <1329268224-26268-3-git-send-email-stefan.tauner@student.tuwien.ac.at>
Download mbox | patch
Permalink /patch/3532/
State Accepted
Commit r1561
Headers show

Comments

Stefan Tauner - 2012-02-15 01:10:21
Make them real progress indicators with a final "done" message on success.

Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
---
 at25.c  |   21 ++++++++++++---------
 spi25.c |    5 +++--
 2 files changed, 15 insertions(+), 11 deletions(-)
Stefan Tauner - 2012-08-02 23:59:19
On Wed, 15 Feb 2012 02:10:21 +0100
Stefan Tauner <stefan.tauner@student.tuwien.ac.at> wrote:

> Make them real progress indicators with a final "done" message on success.
> 
> Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>

self-acked and committed in r1561 (please see previous mail for a
rationale).

Patch

diff --git a/at25.c b/at25.c
index 8891e2b..817e769 100644
--- a/at25.c
+++ b/at25.c
@@ -164,7 +164,7 @@  int spi_disable_blockprotect_at25df(struct flashctx *flash)
 	if ((status & (3 << 2)) == 0)
 		return 0;
 
-	msg_cdbg("Some block protection in effect, disabling\n");
+	msg_cdbg("Some block protection in effect, disabling... ");
 	if (status & (1 << 7)) {
 		msg_cdbg("Need to disable Sector Protection Register Lock\n");
 		if ((status & (1 << 4)) == 0) {
@@ -175,7 +175,7 @@  int spi_disable_blockprotect_at25df(struct flashctx *flash)
 		/* All bits except bit 7 (SPRL) are readonly. */
 		result = spi_write_status_register(flash, status & ~(1 << 7));
 		if (result) {
-			msg_cerr("spi_write_status_register failed\n");
+			msg_cerr("spi_write_status_register failed.\n");
 			return result;
 		}
 		
@@ -183,7 +183,7 @@  int spi_disable_blockprotect_at25df(struct flashctx *flash)
 	/* Global unprotect. Make sure to mask SPRL as well. */
 	result = spi_write_status_register(flash, status & ~0xbc);
 	if (result) {
-		msg_cerr("spi_write_status_register failed\n");
+		msg_cerr("spi_write_status_register failed.\n");
 		return result;
 	}
 	status = spi_read_status_register(flash);
@@ -191,6 +191,7 @@  int spi_disable_blockprotect_at25df(struct flashctx *flash)
 		msg_cerr("Block protection could not be disabled!\n");
 		return 1;
 	}
+	msg_cdbg("done.\n");
 	return 0;
 }
 
@@ -219,20 +220,20 @@  int spi_disable_blockprotect_at25fs010(struct flashctx *flash)
 	if ((status & 0x6c) == 0)
 		return 0;
 
-	msg_cdbg("Some block protection in effect, disabling\n");
+	msg_cdbg("Some block protection in effect, disabling... ");
 	if (status & (1 << 7)) {
 		msg_cdbg("Need to disable Status Register Write Protect\n");
 		/* Clear bit 7 (WPEN). */
 		result = spi_write_status_register(flash, status & ~(1 << 7));
 		if (result) {
-			msg_cerr("spi_write_status_register failed\n");
+			msg_cerr("spi_write_status_register failed.\n");
 			return result;
 		}
 	}
 	/* Global unprotect. Make sure to mask WPEN as well. */
 	result = spi_write_status_register(flash, status & ~0xec);
 	if (result) {
-		msg_cerr("spi_write_status_register failed\n");
+		msg_cerr("spi_write_status_register failed.\n");
 		return result;
 	}
 	status = spi_read_status_register(flash);
@@ -240,6 +241,7 @@  int spi_disable_blockprotect_at25fs010(struct flashctx *flash)
 		msg_cerr("Block protection could not be disabled!\n");
 		return 1;
 	}
+	msg_cdbg("done.\n");
 	return 0;
 }
 
@@ -253,20 +255,20 @@  int spi_disable_blockprotect_at25fs040(struct flashctx *flash)
 	if ((status & 0x7c) == 0)
 		return 0;
 
-	msg_cdbg("Some block protection in effect, disabling\n");
+	msg_cdbg("Some block protection in effect, disabling... ");
 	if (status & (1 << 7)) {
 		msg_cdbg("Need to disable Status Register Write Protect\n");
 		/* Clear bit 7 (WPEN). */
 		result = spi_write_status_register(flash, status & ~(1 << 7));
 		if (result) {
-			msg_cerr("spi_write_status_register failed\n");
+			msg_cerr("spi_write_status_register failed.\n");
 			return result;
 		}
 	}
 	/* Global unprotect. Make sure to mask WPEN as well. */
 	result = spi_write_status_register(flash, status & ~0xfc);
 	if (result) {
-		msg_cerr("spi_write_status_register failed\n");
+		msg_cerr("spi_write_status_register failed.\n");
 		return result;
 	}
 	status = spi_read_status_register(flash);
@@ -274,5 +276,6 @@  int spi_disable_blockprotect_at25fs040(struct flashctx *flash)
 		msg_cerr("Block protection could not be disabled!\n");
 		return 1;
 	}
+	msg_cdbg("done.\n");
 	return 0;
 }
diff --git a/spi25.c b/spi25.c
index eaae204..5c5048d 100644
--- a/spi25.c
+++ b/spi25.c
@@ -951,10 +951,10 @@  int spi_disable_blockprotect(struct flashctx *flash)
 	if ((status & 0x3c) == 0)
 		return 0;
 
-	msg_cdbg("Some block protection in effect, disabling\n");
+	msg_cdbg("Some block protection in effect, disabling... ");
 	result = spi_write_status_register(flash, status & ~0x3c);
 	if (result) {
-		msg_cerr("spi_write_status_register failed\n");
+		msg_cerr("spi_write_status_register failed.\n");
 		return result;
 	}
 	status = spi_read_status_register(flash);
@@ -962,6 +962,7 @@  int spi_disable_blockprotect(struct flashctx *flash)
 		msg_cerr("Block protection could not be disabled!\n");
 		return 1;
 	}
+	msg_cdbg("done.\n");
 	return 0;
 }