Patchwork [08/10] Add return code to rmmio_valw

login
register
about
Submitter Niklas
Date 2013-09-23 18:27:27
Message ID <1379960849-20585-9-git-send-email-niso@kth.se>
Download mbox | patch
Permalink /patch/4059/
State New
Headers show

Comments

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

Patch

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 */