yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
958e1b
From ce4b6f19e7e027480606076804cc6da2cccf99ba Mon Sep 17 00:00:00 2001
958e1b
From: Gerd Hoffmann <kraxel@redhat.com>
958e1b
Date: Mon, 27 Oct 2014 11:45:22 +0100
958e1b
Subject: [PATCH 14/19] ac97: register reset via qom
958e1b
958e1b
Message-id: <1414410322-25041-2-git-send-email-kraxel@redhat.com>
958e1b
Patchwork-id: 61905
958e1b
O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/1] ac97: register reset via qom
958e1b
Bugzilla: 1141667
958e1b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
958e1b
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
958e1b
RH-Acked-by: Amos Kong <akong@redhat.com>
958e1b
958e1b
So it gets properly unregistered on hot-unplug.
958e1b
958e1b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
958e1b
(cherry picked from commit 133771477c39f3716d9a85609aca0d3e5a77c55c)
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
---
958e1b
 hw/audio/ac97.c | 8 ++++----
958e1b
 1 file changed, 4 insertions(+), 4 deletions(-)
958e1b
958e1b
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
958e1b
index 8455a96..7f6763f 100644
958e1b
--- a/hw/audio/ac97.c
958e1b
+++ b/hw/audio/ac97.c
958e1b
@@ -1323,9 +1323,9 @@ static const MemoryRegionOps ac97_io_nabm_ops = {
958e1b
     .endianness = DEVICE_LITTLE_ENDIAN,
958e1b
 };
958e1b
 
958e1b
-static void ac97_on_reset (void *opaque)
958e1b
+static void ac97_on_reset (DeviceState *dev)
958e1b
 {
958e1b
-    AC97LinkState *s = opaque;
958e1b
+    AC97LinkState *s = container_of(dev, AC97LinkState, dev.qdev);
958e1b
 
958e1b
     reset_bm_regs (s, &s->bm_regs[0]);
958e1b
     reset_bm_regs (s, &s->bm_regs[1]);
958e1b
@@ -1382,9 +1382,8 @@ static int ac97_initfn (PCIDevice *dev)
958e1b
     memory_region_init_io (&s->io_nabm, &ac97_io_nabm_ops, s, "ac97-nabm", 256);
958e1b
     pci_register_bar (&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam);
958e1b
     pci_register_bar (&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm);
958e1b
-    qemu_register_reset (ac97_on_reset, s);
958e1b
     AUD_register_card ("ac97", &s->card);
958e1b
-    ac97_on_reset (s);
958e1b
+    ac97_on_reset (&s->dev.qdev);
958e1b
     return 0;
958e1b
 }
958e1b
 
958e1b
@@ -1422,6 +1421,7 @@ static void ac97_class_init (ObjectClass *klass, void *data)
958e1b
     dc->desc = "Intel 82801AA AC97 Audio";
958e1b
     dc->vmsd = &vmstate_ac97;
958e1b
     dc->props = ac97_properties;
958e1b
+    dc->reset = ac97_on_reset;
958e1b
 }
958e1b
 
958e1b
 static const TypeInfo ac97_info = {
958e1b
-- 
958e1b
1.8.3.1
958e1b