Patchwork [01/10] Add return code to rmmio_writeb

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

Comments

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

Patch

diff --git a/hwaccess.c b/hwaccess.c
index 5b18c32..d8066b0 100644
--- a/hwaccess.c
+++ b/hwaccess.c
@@ -236,10 +236,11 @@  int undo_mmio_write(void *p)
 #define register_undo_mmio_writew(a) register_undo_mmio_write(a, w)
 #define register_undo_mmio_writel(a) register_undo_mmio_write(a, l)
 
-void rmmio_writeb(uint8_t val, void *addr)
+int rmmio_writeb(uint8_t val, void *addr)
 {
 	register_undo_mmio_writeb(addr);
 	mmio_writeb(val, addr);
+	return 0;
 }
 
 void rmmio_writew(uint16_t val, void *addr)
diff --git a/programmer.h b/programmer.h
index ef96c9e..d86b791 100644
--- a/programmer.h
+++ b/programmer.h
@@ -347,7 +347,7 @@  uint32_t mmio_le_readl(void *addr);
 #define pci_mmio_readb mmio_le_readb
 #define pci_mmio_readw mmio_le_readw
 #define pci_mmio_readl mmio_le_readl
-void rmmio_writeb(uint8_t val, void *addr);
+int rmmio_writeb(uint8_t val, void *addr);
 void rmmio_writew(uint16_t val, void *addr);
 void rmmio_writel(uint32_t val, void *addr);
 void rmmio_le_writeb(uint8_t val, void *addr);
diff --git a/sb600spi.c b/sb600spi.c
index 9523591..4668da0 100644
--- a/sb600spi.c
+++ b/sb600spi.c
@@ -291,7 +291,8 @@  static int set_speed(struct pci_dev *dev, const struct spispeed *spispeed)
 
 	msg_pdbg("Setting SPI clock to %s (0x%x).\n", spispeed->name, speed);
 	if (amd_gen != CHIPSET_YANGTZE) {
-		rmmio_writeb((mmio_readb(sb600_spibar + 0xd) & ~(0x3 << 4)) | (speed << 4), sb600_spibar + 0xd);
+		if (rmmio_writeb((mmio_readb(sb600_spibar + 0xd) & ~(0x3 << 4)) | (speed << 4), sb600_spibar + 0xd))
+			return 1;
 		success = (speed == ((mmio_readb(sb600_spibar + 0xd) >> 4) & 0x3));
 	}