Received: from eggs.gnu.org ([2001:4830:134:3::10]:42141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VapvF-0007R6-Ap for qemu-devel@nongnu.org; Mon, 28 Oct 2013 12:44:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vapv6-0000ND-DW for qemu-devel@nongnu.org; Mon, 28 Oct 2013 12:44:09 -0400 Received: from mail-qc0-x236.google.com ([2607:f8b0:400d:c01::236]:46605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vapv6-0000N4-7G for qemu-devel@nongnu.org; Mon, 28 Oct 2013 12:44:00 -0400 Received: by mail-qc0-f182.google.com with SMTP id n7so4010993qcx.13 for ; Mon, 28 Oct 2013 09:43:59 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 28 Oct 2013 17:43:21 +0100 Message-Id: <1382978620-16641-6-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 05/24] ide: simplify reset 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 | 6 ------ hw/ide/core.c | 5 +++-- hw/ide/internal.h | 3 ++- hw/ide/macio.c | 1 - hw/ide/pci.c | 4 +--- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index a8be62c..d74b6ab 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1137,11 +1137,6 @@ static void ahci_dma_restart_cb(void *opaque, int running, RunState state) { } -static int ahci_dma_reset(IDEDMA *dma) -{ - return 0; -} - static const IDEDMAOps ahci_dma_ops = { .start_dma = ahci_start_dma, .start_transfer = ahci_start_transfer, @@ -1152,7 +1147,6 @@ static const IDEDMAOps ahci_dma_ops = { .set_inactive = ahci_dma_set_inactive, .async_cmd_done = ahci_async_cmd_done, .restart_cb = ahci_dma_restart_cb, - .reset = ahci_dma_reset, }; void ahci_init(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports) diff --git a/hw/ide/core.c b/hw/ide/core.c index 399b1ba..8437ead 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -2057,7 +2057,9 @@ void ide_bus_reset(IDEBus *bus) } /* reset dma provider too */ - bus->dma->ops->reset(bus->dma); + if (bus->dma->ops->reset) { + bus->dma->ops->reset(bus->dma); + } } static bool ide_cd_is_tray_open(void *opaque) @@ -2195,7 +2197,6 @@ static const IDEDMAOps ide_dma_nop_ops = { .add_status = ide_nop_int, .set_inactive = ide_nop, .restart_cb = ide_nop_restart, - .reset = ide_nop, }; static IDEDMA ide_dma_nop = { diff --git a/hw/ide/internal.h b/hw/ide/internal.h index 5d1cf87..84f3a7a 100644 --- a/hw/ide/internal.h +++ b/hw/ide/internal.h @@ -320,6 +320,7 @@ typedef enum { IDE_HD, IDE_CD, IDE_CFATA } IDEDriveKind; 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); @@ -435,7 +436,7 @@ struct IDEDMAOps { DMAFunc *set_inactive; DMAFunc *async_cmd_done; DMARestartFunc *restart_cb; - DMAFunc *reset; + DMAVoidFunc *reset; }; struct IDEDMA { diff --git a/hw/ide/macio.c b/hw/ide/macio.c index da94580..b3cb6ca 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -528,7 +528,6 @@ static const IDEDMAOps dbdma_ops = { .add_status = ide_nop_int, .set_inactive = ide_nop, .restart_cb = ide_nop_restart, - .reset = ide_nop, }; static void macio_ide_realizefn(DeviceState *dev, Error **errp) diff --git a/hw/ide/pci.c b/hw/ide/pci.c index 91151fc..a9eb5bf 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -247,7 +247,7 @@ static void bmdma_cancel(BMDMAState *bm) } } -static int bmdma_reset(IDEDMA *dma) +static void bmdma_reset(IDEDMA *dma) { BMDMAState *bm = DO_UPCAST(BMDMAState, dma, dma); @@ -264,8 +264,6 @@ static int bmdma_reset(IDEDMA *dma) bm->cur_prd_len = 0; bm->sector_num = 0; bm->nsector = 0; - - return 0; } static int bmdma_start_transfer(IDEDMA *dma) -- 1.8.3.1