Patchwork [qom-next,for-1.6,3/4] milkymist-ac97: QOM'ify

login
register
mail settings
Submitter Andreas Färber
Date July 24, 2013, 8:35 a.m.
Message ID <1374654954-30128-4-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/261348/
State New
Headers show

Comments

Andreas Färber - July 24, 2013, 8:35 a.m.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/audio/milkymist-ac97.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
Hu Tao - July 26, 2013, 8:52 a.m.
On Wed, Jul 24, 2013 at 10:35:53AM +0200, Andreas Färber wrote:
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  hw/audio/milkymist-ac97.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)

Reviewed-by: Hu Tao <hutao@cn.fujitsu.com>

Patch

diff --git a/hw/audio/milkymist-ac97.c b/hw/audio/milkymist-ac97.c
index 133de4e..9c0f7a0 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,