From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Jason Wang" <jasowang@redhat.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Laurent Vivier" <laurent@vivier.eu>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH 2/3] hw/scsi/esp: Let ESPDMAMemoryReadWriteFunc take void pointer and size_t
Date: Fri, 21 Feb 2020 14:25:49 +0100 [thread overview]
Message-ID: <20200221132550.22156-3-philmd@redhat.com> (raw)
In-Reply-To: <20200221132550.22156-1-philmd@redhat.com>
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(-)
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
next prev parent reply other threads:[~2020-02-21 13:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-21 13:25 [PATCH 0/3] hw: More dma_memory_read/write() API cleanup Philippe Mathieu-Daudé
2020-02-21 13:25 ` [PATCH 1/3] hw/dma/sparc32_dma: Make espdma_memory_[read/write] static Philippe Mathieu-Daudé
2020-02-21 13:27 ` Peter Maydell
2020-02-21 13:25 ` Philippe Mathieu-Daudé [this message]
2020-02-21 13:25 ` [PATCH 3/3] hw/net/pcnet: Let phys_mem_read/write take void pointer and boolean Philippe Mathieu-Daudé
2020-02-21 16:34 ` [PATCH 0/3] hw: More dma_memory_read/write() API cleanup Paolo Bonzini
2020-02-22 19:39 ` Mark Cave-Ayland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200221132550.22156-3-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=fam@euphon.net \
--cc=jasowang@redhat.com \
--cc=laurent@vivier.eu \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).