Patchwork [08/32] qdev/prop: convert etraxfs_pic.c to helper macros.

login
register
mail settings
Submitter Gerd Hoffmann
Date Aug. 3, 2009, 3:35 p.m.
Message ID <1249313748-6459-9-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/30620/
State Superseded
Headers show

Comments

Gerd Hoffmann - Aug. 3, 2009, 3:35 p.m.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/etraxfs_pic.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

Patch

diff --git a/hw/etraxfs_pic.c b/hw/etraxfs_pic.c
index e627218..4527d98 100644
--- a/hw/etraxfs_pic.c
+++ b/hw/etraxfs_pic.c
@@ -39,7 +39,7 @@ 
 struct etrax_pic
 {
     SysBusDevice busdev;
-    uint32_t *interrupt_vector;
+    void *interrupt_vector;
     qemu_irq parent_irq;
     qemu_irq parent_nmi;
     uint32_t regs[R_MAX];
@@ -71,7 +71,8 @@  static void pic_update(struct etrax_pic *fs)
     }
 
     if (fs->interrupt_vector) {
-        *fs->interrupt_vector = vector;
+        /* hack alert: ptr property */
+        *(uint32_t*)(fs->interrupt_vector) = vector;
     }
     qemu_set_irq(fs->parent_irq, !!vector);
 }
@@ -153,12 +154,8 @@  static SysBusDeviceInfo etraxfs_pic_info = {
     .qdev.name  = "etraxfs,pic",
     .qdev.size  = sizeof(struct etrax_pic),
     .qdev.props = (Property[]) {
-        {
-            .name   = "interrupt_vector",
-            .info   = &qdev_prop_ptr,
-            .offset = offsetof(struct etrax_pic, interrupt_vector),
-        },
-        {/* end of list */}
+        DEFINE_PROP_PTR("interrupt_vector", struct etrax_pic, interrupt_vector),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };