[flashrom] [PATCH 08/10] Add return code to rmmio_valw

Niklas Söderlund niso at kth.se
Mon Sep 23 20:27:27 CEST 2013


Signed-off-by: Niklas Söderlund <niso at kth.se>
---
 hwaccess.c   |  3 ++-
 ichspi.c     | 12 ++++++++----
 programmer.h |  2 +-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/hwaccess.c b/hwaccess.c
index 484963e..540c713 100644
--- a/hwaccess.c
+++ b/hwaccess.c
@@ -284,9 +284,10 @@ int rmmio_valb(void *addr)
 	return 0;
 }
 
-void rmmio_valw(void *addr)
+int rmmio_valw(void *addr)
 {
 	register_undo_mmio_writew(addr);
+	return 0;
 }
 
 void rmmio_vall(void *addr)
diff --git a/ichspi.c b/ichspi.c
index 9dfe4ff..8c131a5 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -540,8 +540,10 @@ static int program_opcodes(OPCODES *op, int enable_undo)
 	case CHIPSET_ICH7:
 		/* Register undo only for enable_undo=1, i.e. first call. */
 		if (enable_undo) {
-			rmmio_valw(ich_spibar + ICH7_REG_PREOP);
-			rmmio_valw(ich_spibar + ICH7_REG_OPTYPE);
+			if (rmmio_valw(ich_spibar + ICH7_REG_PREOP))
+				return 1;
+			if (rmmio_valw(ich_spibar + ICH7_REG_OPTYPE))
+				return 1;
 			rmmio_vall(ich_spibar + ICH7_REG_OPMENU);
 			rmmio_vall(ich_spibar + ICH7_REG_OPMENU + 4);
 		}
@@ -554,8 +556,10 @@ static int program_opcodes(OPCODES *op, int enable_undo)
 	default:		/* Future version might behave the same */
 		/* Register undo only for enable_undo=1, i.e. first call. */
 		if (enable_undo) {
-			rmmio_valw(ich_spibar + ICH9_REG_PREOP);
-			rmmio_valw(ich_spibar + ICH9_REG_OPTYPE);
+			if (rmmio_valw(ich_spibar + ICH9_REG_PREOP))
+				return 1;
+			if (rmmio_valw(ich_spibar + ICH9_REG_OPTYPE))
+				return 1;
 			rmmio_vall(ich_spibar + ICH9_REG_OPMENU);
 			rmmio_vall(ich_spibar + ICH9_REG_OPMENU + 4);
 		}
diff --git a/programmer.h b/programmer.h
index ee7e9bd..0f3c310 100644
--- a/programmer.h
+++ b/programmer.h
@@ -357,7 +357,7 @@ int rmmio_le_writel(uint32_t val, void *addr);
 #define pci_rmmio_writew rmmio_le_writew
 #define pci_rmmio_writel rmmio_le_writel
 int rmmio_valb(void *addr);
-void rmmio_valw(void *addr);
+int rmmio_valw(void *addr);
 void rmmio_vall(void *addr);
 
 /* dummyflasher.c */
-- 
1.8.3.4





More information about the flashrom mailing list