From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Vassili Karpov (malc)" <av1474@comtv.ru>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 1/1] ac97: register reset via qom
Date: Tue, 30 Sep 2014 13:33:34 +0200 [thread overview]
Message-ID: <1412076814-21725-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1412076814-21725-1-git-send-email-kraxel@redhat.com>
So it gets properly unregistered on hot-unplug.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/audio/ac97.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
index 0e22bb9..111ec0e 100644
--- a/hw/audio/ac97.c
+++ b/hw/audio/ac97.c
@@ -1321,9 +1321,9 @@ static const MemoryRegionOps ac97_io_nabm_ops = {
.endianness = DEVICE_LITTLE_ENDIAN,
};
-static void ac97_on_reset (void *opaque)
+static void ac97_on_reset (DeviceState *dev)
{
- AC97LinkState *s = opaque;
+ AC97LinkState *s = container_of(dev, AC97LinkState, dev.qdev);
reset_bm_regs (s, &s->bm_regs[0]);
reset_bm_regs (s, &s->bm_regs[1]);
@@ -1382,9 +1382,8 @@ static int ac97_initfn (PCIDevice *dev)
"ac97-nabm", 256);
pci_register_bar (&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam);
pci_register_bar (&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm);
- qemu_register_reset (ac97_on_reset, s);
AUD_register_card ("ac97", &s->card);
- ac97_on_reset (s);
+ ac97_on_reset (&s->dev.qdev);
return 0;
}
@@ -1413,6 +1412,7 @@ static void ac97_class_init (ObjectClass *klass, void *data)
dc->desc = "Intel 82801AA AC97 Audio";
dc->vmsd = &vmstate_ac97;
dc->props = ac97_properties;
+ dc->reset = ac97_on_reset;
}
static const TypeInfo ac97_info = {
--
1.8.3.1
next prev parent reply other threads:[~2014-09-30 11:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-30 11:33 [Qemu-devel] [PULL 0/1] audio patch queue Gerd Hoffmann
2014-09-30 11:33 ` Gerd Hoffmann [this message]
2014-09-30 14:46 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1412076814-21725-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=av1474@comtv.ru \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).