Received: from eggs.gnu.org ([2001:4830:134:3::10]:42342) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VapvZ-0007xG-K5 for qemu-devel@nongnu.org; Mon, 28 Oct 2013 12:44:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VapvQ-0000UI-VN for qemu-devel@nongnu.org; Mon, 28 Oct 2013 12:44:29 -0400 Received: from mail-qc0-x232.google.com ([2607:f8b0:400d:c01::232]:53240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VapvQ-0000UD-Ql for qemu-devel@nongnu.org; Mon, 28 Oct 2013 12:44:20 -0400 Received: by mail-qc0-f178.google.com with SMTP id x19so3905582qcw.23 for ; Mon, 28 Oct 2013 09:44:20 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 28 Oct 2013 17:43:32 +0100 Message-Id: <1382978620-16641-17-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 16/24] ide: introduce ide_register_restart_cb List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mst@redhat.com Signed-off-by: Paolo Bonzini --- hw/ide/cmd646.c | 3 +-- hw/ide/core.c | 5 +++++ hw/ide/internal.h | 1 + hw/ide/piix.c | 3 +-- hw/ide/via.c | 3 +-- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index 0500a7a..4753543 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -294,8 +294,7 @@ static int pci_cmd646_ide_initfn(PCIDevice *dev) bmdma_init(&d->bus[i], &d->bmdma[i], d); d->bmdma[i].bus = &d->bus[i]; - qemu_add_vm_change_state_handler(d->bus[i].dma->ops->restart_cb, - &d->bmdma[i].dma); + ide_register_restart_cb(&d->bus[i]); } vmstate_register(DEVICE(dev), 0, &vmstate_ide_pci, d); diff --git a/hw/ide/core.c b/hw/ide/core.c index 1e3108c..93cfd46 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -2193,6 +2193,11 @@ static const IDEDMAOps ide_dma_nop_ops = { .restart_cb = ide_nop_restart, }; +void ide_register_restart_cb(IDEBus *bus) +{ + qemu_add_vm_change_state_handler(bus->dma->ops->restart_cb, bus->dma); +} + static IDEDMA ide_dma_nop = { .ops = &ide_dma_nop_ops, .aiocb = NULL, diff --git a/hw/ide/internal.h b/hw/ide/internal.h index 96969d9..678b33c 100644 --- a/hw/ide/internal.h +++ b/hw/ide/internal.h @@ -548,6 +548,7 @@ void ide_init2(IDEBus *bus, qemu_irq irq); void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0, DriveInfo *hd1, qemu_irq irq); void ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2); +void ide_register_restart_cb(IDEBus *bus); void ide_exec_cmd(IDEBus *bus, uint32_t val); void ide_dma_cb(void *opaque, int ret); diff --git a/hw/ide/piix.c b/hw/ide/piix.c index ab36749..d7f5118 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -143,8 +143,7 @@ static void pci_piix_init_ports(PCIIDEState *d) { bmdma_init(&d->bus[i], &d->bmdma[i], d); d->bmdma[i].bus = &d->bus[i]; - qemu_add_vm_change_state_handler(d->bus[i].dma->ops->restart_cb, - &d->bmdma[i].dma); + ide_register_restart_cb(&d->bus[i]); } } diff --git a/hw/ide/via.c b/hw/ide/via.c index 99468c7..ae52164 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -166,8 +166,7 @@ static void vt82c686b_init_ports(PCIIDEState *d) { bmdma_init(&d->bus[i], &d->bmdma[i], d); d->bmdma[i].bus = &d->bus[i]; - qemu_add_vm_change_state_handler(d->bus[i].dma->ops->restart_cb, - &d->bmdma[i].dma); + ide_register_restart_cb(&d->bus[i]); } } -- 1.8.3.1