summaryrefslogtreecommitdiff
path: root/hw/audio
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-07-24 10:15:29 +0200
committerAndreas Färber <afaerber@suse.de>2013-07-29 21:05:58 +0200
commit922cc6010e09ed5b976b2e60228b3d6fb09aa3a5 (patch)
tree1edb657afaf46b041bbb34bc7bb9716a3baf9de6 /hw/audio
parent9e3f8599fc9b3a408fdaaa5a38d6bc328c08c4bb (diff)
downloadqemu-922cc6010e09ed5b976b2e60228b3d6fb09aa3a5.tar.gz
milkymist-ac97: QOM cast cleanup
Introduce a type constant, use QOM casts and rename the parent field. Reviewed-by: Hu Tao <hutao@cn.fujitsu.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/audio')
-rw-r--r--hw/audio/milkymist-ac97.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/audio/milkymist-ac97.c b/hw/audio/milkymist-ac97.c
index 133de4e74c..9c0f7a092d 100644
--- a/hw/audio/milkymist-ac97.c
+++ b/hw/audio/milkymist-ac97.c
@@ -51,8 +51,13 @@ enum {
CTRL_EN = (1<<0),
};
+#define TYPE_MILKYMIST_AC97 "milkymist-ac97"
+#define MILKYMIST_AC97(obj) \
+ OBJECT_CHECK(MilkymistAC97State, (obj), TYPE_MILKYMIST_AC97)
+
struct MilkymistAC97State {
- SysBusDevice busdev;
+ SysBusDevice parent_obj;
+
MemoryRegion regs_region;
QEMUSoundCard card;
@@ -258,7 +263,7 @@ static void ac97_out_cb(void *opaque, int free_b)
static void milkymist_ac97_reset(DeviceState *d)
{
- MilkymistAC97State *s = container_of(d, MilkymistAC97State, busdev.qdev);
+ MilkymistAC97State *s = MILKYMIST_AC97(d);
int i;
for (i = 0; i < R_MAX; i++) {
@@ -280,7 +285,7 @@ static int ac97_post_load(void *opaque, int version_id)
static int milkymist_ac97_init(SysBusDevice *dev)
{
- MilkymistAC97State *s = FROM_SYSBUS(typeof(*s), dev);
+ MilkymistAC97State *s = MILKYMIST_AC97(dev);
struct audsettings as;
sysbus_init_irq(dev, &s->crrequest_irq);
@@ -330,7 +335,7 @@ static void milkymist_ac97_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo milkymist_ac97_info = {
- .name = "milkymist-ac97",
+ .name = TYPE_MILKYMIST_AC97,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(MilkymistAC97State),
.class_init = milkymist_ac97_class_init,