[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 05/30] ide: simplify reset callbacks
From: |
John Snow |
Subject: |
[Qemu-devel] [PATCH v2 05/30] ide: simplify reset callbacks |
Date: |
Mon, 4 Aug 2014 17:11:06 -0400 |
From: Paolo Bonzini <address@hidden>
Drop the unused return value and make the callback optional.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: John Snow <address@hidden>
---
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 604152a..273712f 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1147,11 +1147,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,
@@ -1162,7 +1157,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 79985f9..4183a3a 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2088,7 +2088,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)
@@ -2226,7 +2228,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 0567a52..6cca46f 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 c14a1dd..ca39e3f 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -578,7 +578,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 6257a21..c24496a 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.9.3
- [Qemu-devel] [PATCH v2 00/30] AHCI test suite framework, John Snow, 2014/08/04
- [Qemu-devel] [PATCH v2 01/30] blkdebug: report errors on flush too, John Snow, 2014/08/04
- [Qemu-devel] [PATCH v2 05/30] ide: simplify reset callbacks,
John Snow <=
- [Qemu-devel] [PATCH v2 02/30] libqtest: add QTEST_LOG for debugging qtest testcases, John Snow, 2014/08/04
- [Qemu-devel] [PATCH v2 07/30] ide: simplify async_cmd_done callbacks, John Snow, 2014/08/04
- [Qemu-devel] [PATCH v2 03/30] ide-test: add test for werror=stop, John Snow, 2014/08/04
- [Qemu-devel] [PATCH v2 09/30] ide: wrap start_dma callback, John Snow, 2014/08/04
- [Qemu-devel] [PATCH v2 08/30] ide: simplify start_transfer callbacks, John Snow, 2014/08/04
- [Qemu-devel] [PATCH v2 06/30] ide: simplify set_inactive callbacks, John Snow, 2014/08/04
- [Qemu-devel] [PATCH v2 11/30] ide: fold add_status callback into set_inactive, John Snow, 2014/08/04
- [Qemu-devel] [PATCH v2 04/30] ide: stash aiocb for flushes, John Snow, 2014/08/04
- [Qemu-devel] [PATCH v2 10/30] ide: remove wrong setting of BM_STATUS_INT, John Snow, 2014/08/04
- [Qemu-devel] [PATCH v2 13/30] ide: move retry constants out of BM_STATUS_* namespace, John Snow, 2014/08/04