From: Li Qiang <liq3ea@163.com>
To: kraxel@redhat.com
Cc: qemu-devel@nongnu.org, Li Qiang <liq3ea@163.com>
Subject: [Qemu-devel] [PATCH] hw: AC97: make it more QOMconventional
Date: Fri, 12 Oct 2018 23:08:09 -0700 [thread overview]
Message-ID: <20181013060809.52496-1-liq3ea@163.com> (raw)
Signed-off-by: Li Qiang <liq3ea@163.com>
---
hw/audio/ac97.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
index 337402e9c6..d799533aa9 100644
--- a/hw/audio/ac97.c
+++ b/hw/audio/ac97.c
@@ -123,6 +123,10 @@ enum {
#define MUTE_SHIFT 15
+#define TYPE_AC97 "AC97"
+#define AC97(obj) \
+ OBJECT_CHECK(AC97LinkState, (obj), TYPE_AC97)
+
#define REC_MASK 7
enum {
REC_MIC = 0,
@@ -1340,7 +1344,7 @@ static void ac97_on_reset (DeviceState *dev)
static void ac97_realize(PCIDevice *dev, Error **errp)
{
- AC97LinkState *s = DO_UPCAST (AC97LinkState, dev, dev);
+ AC97LinkState *s = AC97(dev);
uint8_t *c = s->dev.config;
/* TODO: no need to override */
@@ -1389,7 +1393,7 @@ static void ac97_realize(PCIDevice *dev, Error **errp)
static void ac97_exit(PCIDevice *dev)
{
- AC97LinkState *s = DO_UPCAST(AC97LinkState, dev, dev);
+ AC97LinkState *s = AC97(dev);
AUD_close_in(&s->card, s->voice_pi);
AUD_close_out(&s->card, s->voice_po);
@@ -1399,7 +1403,7 @@ static void ac97_exit(PCIDevice *dev)
static int ac97_init (PCIBus *bus)
{
- pci_create_simple (bus, -1, "AC97");
+ pci_create_simple(bus, -1, TYPE_AC97);
return 0;
}
@@ -1427,7 +1431,7 @@ static void ac97_class_init (ObjectClass *klass, void *data)
}
static const TypeInfo ac97_info = {
- .name = "AC97",
+ .name = TYPE_AC97,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof (AC97LinkState),
.class_init = ac97_class_init,
--
2.17.1
next reply other threads:[~2018-10-13 6:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-13 6:08 Li Qiang [this message]
2018-10-13 20:37 ` [Qemu-devel] [PATCH] hw: AC97: make it more QOMconventional Philippe Mathieu-Daudé
2018-10-19 8:05 ` Gerd Hoffmann
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=20181013060809.52496-1-liq3ea@163.com \
--to=liq3ea@163.com \
--cc=kraxel@redhat.com \
--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).