[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] hw/scsi/esp: Let ESPDMAMemoryReadWriteFunc take void pointer
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 2/3] hw/scsi/esp: Let ESPDMAMemoryReadWriteFunc take void pointer and size_t |
Date: |
Fri, 21 Feb 2020 14:25:49 +0100 |
The ESPDMAMemoryReadWriteFunc handlers end calling
dma_memory_read/write, which both take void pointers (since
introduced in commit d86a77f8). The ESPDMAMemoryReadWriteFunc
handlers can take a void pointer too.
All calls to these handlers in hw/scsi/esp.c use an unsigned
length. Use size_t type.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
include/hw/scsi/esp.h | 2 +-
hw/dma/sparc32_dma.c | 4 ++--
hw/scsi/esp-pci.c | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h
index 6ba47dac41..fff0ebc4d4 100644
--- a/include/hw/scsi/esp.h
+++ b/include/hw/scsi/esp.h
@@ -6,7 +6,7 @@
/* esp.c */
#define ESP_MAX_DEVS 7
-typedef void (*ESPDMAMemoryReadWriteFunc)(void *opaque, uint8_t *buf, int len);
+typedef void (*ESPDMAMemoryReadWriteFunc)(void *opaque, void *buf, size_t len);
#define ESP_REGS 16
#define TI_BUFSZ 16
diff --git a/hw/dma/sparc32_dma.c b/hw/dma/sparc32_dma.c
index c9e313938c..fbe58b8fea 100644
--- a/hw/dma/sparc32_dma.c
+++ b/hw/dma/sparc32_dma.c
@@ -142,7 +142,7 @@ static void dma_set_irq(void *opaque, int irq, int level)
}
}
-static void espdma_memory_read(void *opaque, uint8_t *buf, int len)
+static void espdma_memory_read(void *opaque, void *buf, size_t len)
{
DMADeviceState *s = opaque;
IOMMUState *is = (IOMMUState *)s->iommu;
@@ -152,7 +152,7 @@ static void espdma_memory_read(void *opaque, uint8_t *buf,
int len)
s->dmaregs[1] += len;
}
-static void espdma_memory_write(void *opaque, uint8_t *buf, int len)
+static void espdma_memory_write(void *opaque, void *buf, size_t len)
{
DMADeviceState *s = opaque;
IOMMUState *is = (IOMMUState *)s->iommu;
diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c
index d5a1f9e017..8f11c4a2d2 100644
--- a/hw/scsi/esp-pci.c
+++ b/hw/scsi/esp-pci.c
@@ -242,7 +242,7 @@ static uint64_t esp_pci_io_read(void *opaque, hwaddr addr,
return ret;
}
-static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len,
+static void esp_pci_dma_memory_rw(PCIESPState *pci, void *buf, size_t len,
DMADirection dir)
{
dma_addr_t addr;
@@ -278,13 +278,13 @@ static void esp_pci_dma_memory_rw(PCIESPState *pci,
uint8_t *buf, int len,
}
}
-static void esp_pci_dma_memory_read(void *opaque, uint8_t *buf, int len)
+static void esp_pci_dma_memory_read(void *opaque, void *buf, size_t len)
{
PCIESPState *pci = opaque;
esp_pci_dma_memory_rw(pci, buf, len, DMA_DIRECTION_TO_DEVICE);
}
-static void esp_pci_dma_memory_write(void *opaque, uint8_t *buf, int len)
+static void esp_pci_dma_memory_write(void *opaque, void *buf, size_t len)
{
PCIESPState *pci = opaque;
esp_pci_dma_memory_rw(pci, buf, len, DMA_DIRECTION_FROM_DEVICE);
--
2.21.1