From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VapvL-0007Z4-DN for qemu-devel@nongnu.org; Mon, 28 Oct 2013 12:44:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VapvC-0000Oq-2S for qemu-devel@nongnu.org; Mon, 28 Oct 2013 12:44:15 -0400 Received: from mail-qc0-x235.google.com ([2607:f8b0:400d:c01::235]:49209) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VapvB-0000Oe-TY for qemu-devel@nongnu.org; Mon, 28 Oct 2013 12:44:05 -0400 Received: by mail-qc0-f181.google.com with SMTP id w4so3963284qcr.12 for ; Mon, 28 Oct 2013 09:44:05 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 28 Oct 2013 17:43:24 +0100 Message-Id: <1382978620-16641-9-git-send-email-pbonzini@redhat.com> In-Reply-To: <1382978620-16641-1-git-send-email-pbonzini@redhat.com> References: <1382978620-16641-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 08/24] ide: simplify start_transfer callbacks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mst@redhat.com Drop the unused return value and make the callback optional. Signed-off-by: Paolo Bonzini --- hw/ide/ahci.c | 4 +--- hw/ide/core.c | 10 +++------- hw/ide/internal.h | 3 +-- hw/ide/macio.c | 6 ------ hw/ide/pci.c | 6 ------ 5 files changed, 5 insertions(+), 24 deletions(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index b4b8386..23f3f22 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -981,7 +981,7 @@ out: } /* DMA dev <-> ram */ -static int ahci_start_transfer(IDEDMA *dma) +static void ahci_start_transfer(IDEDMA *dma) { AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma); IDEState *s = &ad->port.ifs[0]; @@ -1031,8 +1031,6 @@ out: /* done with DMA */ ahci_trigger_irq(ad->hba, ad, PORT_IRQ_STAT_DSS); } - - return 0; } static void ahci_start_dma(IDEDMA *dma, IDEState *s, diff --git a/hw/ide/core.c b/hw/ide/core.c index 926b90a..e64dfff 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -434,7 +434,9 @@ void ide_transfer_start(IDEState *s, uint8_t *buf, int size, if (!(s->status & ERR_STAT)) { s->status |= DRQ_STAT; } - s->bus->dma->ops->start_transfer(s->bus->dma); + if (s->bus->dma->ops->start_transfer) { + s->bus->dma->ops->start_transfer(s->bus->dma); + } } void ide_transfer_stop(IDEState *s) @@ -2176,11 +2178,6 @@ static void ide_nop_start(IDEDMA *dma, IDEState *s, { } -static int ide_nop(IDEDMA *dma) -{ - return 0; -} - static int ide_nop_int(IDEDMA *dma, int x) { return 0; @@ -2192,7 +2189,6 @@ static void ide_nop_restart(void *opaque, int x, RunState y) static const IDEDMAOps ide_dma_nop_ops = { .start_dma = ide_nop_start, - .start_transfer = ide_nop, .prepare_buf = ide_nop_int, .rw_buf = ide_nop_int, .set_unit = ide_nop_int, diff --git a/hw/ide/internal.h b/hw/ide/internal.h index 43b8f43..92d2351 100644 --- a/hw/ide/internal.h +++ b/hw/ide/internal.h @@ -321,7 +321,6 @@ typedef void EndTransferFunc(IDEState *); typedef void DMAStartFunc(IDEDMA *, IDEState *, BlockDriverCompletionFunc *); typedef void DMAVoidFunc(IDEDMA *); -typedef int DMAFunc(IDEDMA *); typedef int DMAIntFunc(IDEDMA *, int); typedef void DMARestartFunc(void *, int, RunState); @@ -428,7 +427,7 @@ struct IDEState { struct IDEDMAOps { DMAStartFunc *start_dma; - DMAFunc *start_transfer; + DMAVoidFunc *start_transfer; DMAIntFunc *prepare_buf; DMAIntFunc *rw_buf; DMAIntFunc *set_unit; diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 013326d..56e2b0c 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -495,11 +495,6 @@ static void macio_ide_reset(DeviceState *dev) ide_bus_reset(&d->bus); } -static int ide_nop(IDEDMA *dma) -{ - return 0; -} - static int ide_nop_int(IDEDMA *dma, int x) { return 0; @@ -521,7 +516,6 @@ static void ide_dbdma_start(IDEDMA *dma, IDEState *s, static const IDEDMAOps dbdma_ops = { .start_dma = ide_dbdma_start, - .start_transfer = ide_nop, .prepare_buf = ide_nop_int, .rw_buf = ide_nop_int, .set_unit = ide_nop_int, diff --git a/hw/ide/pci.c b/hw/ide/pci.c index b781149..78c47a3 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -264,11 +264,6 @@ static void bmdma_reset(IDEDMA *dma) bm->nsector = 0; } -static int bmdma_start_transfer(IDEDMA *dma) -{ - return 0; -} - static void bmdma_irq(void *opaque, int n, int level) { BMDMAState *bm = opaque; @@ -504,7 +499,6 @@ void pci_ide_create_devs(PCIDevice *dev, DriveInfo **hd_table) static const struct IDEDMAOps bmdma_ops = { .start_dma = bmdma_start_dma, - .start_transfer = bmdma_start_transfer, .prepare_buf = bmdma_prepare_buf, .rw_buf = bmdma_rw_buf, .set_unit = bmdma_set_unit, -- 1.8.3.1