[2/3] hw/scsi/esp: Let ESPDMAMemoryReadWriteFunc take void pointer and size_t
diff mbox series

Message ID 20200221132550.22156-3-philmd@redhat.com
State New
Headers show
Series
  • hw: More dma_memory_read/write() API cleanup
Related show

Commit Message

Philippe Mathieu-Daudé Feb. 21, 2020, 1:25 p.m. UTC
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é <philmd@redhat.com>
---
 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(-)

Patch
diff mbox series

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);