Skip to contentSkip to conversation

qdev: macros for creating typechecked properties.

PATCH In review Gerd Hoffmann 2 participants 35 messages Aug 3, 2009 – Aug 4, 2009 Arm/Zynq architecture

lore
Share & tools
lore
#3 lore raw

PATCH 3/32 qdev/prop: convert pci.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/pci.c |    9 ++-------
 hw/pci.h |    2 +-
 2 files changed, 3 insertions(+), 8 deletions(-)
hw/pci.c +2 -7
index 4d0cdc7..27eac04 100644
@@ -60,13 +60,8 @@ static struct BusInfo pci_bus_info = {
     .size       = sizeof(PCIBus),
     .print_dev  = pcibus_dev_print,
     .props      = (Property[]) {
-        {
-            .name   = "addr",
-            .info   = &qdev_prop_pci_devfn,
-            .offset = offsetof(PCIDevice, devfn),
-            .defval = (uint32_t[]) { -1 },
-        },
-        {/* end of list */}
+        DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
+        DEFINE_PROP_END_OF_LIST()
     }
 };
 
hw/pci.h +1 -1
index cbfea6a..a2ec16a 100644
@@ -177,7 +177,7 @@ struct PCIDevice {
 
     /* the following fields are read only */
     PCIBus *bus;
-    int devfn;
+    uint32_t devfn;
     char name[64];
     PCIIORegion io_regions[PCI_NUM_REGIONS];
 
Signature · 1 line
1.6.2.5
#0 lore raw

cover qdev: macros for creating typechecked properties.

Hi,

Ok, RfC patch got almost no comments, so here we go with a non-RfC patch series converting master as of today to property macros as suggested.

First patch adds the macros. Improved typeched error reporting compared to the last version as suggested by Michael S. Tsirkin. Otherwise unmodified.

Second patch adds a CharDriverState property.

All following patches flip over drivers one by one. They are completely independant from each other. In case there are any vetos or conflicts the patch in question can simply be dropped from the middle of the patch series. I'll take care to resend updated patches if needed.

cheers,
Gerd

#1 lore raw

PATCH 1/32 qdev/prop: macros for creating typechecked properties.

There are DEFINE_PROP_$TYPE("name", struct, field, default) macros for each property type. These macros link the qdev_prop_$name struct to the type used by that property. typeof(struct->field) is verifyed to be the correct one for the given property.

---
 hw/qdev-addr.h |    3 +++
 hw/qdev.h      |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)
hw/qdev-addr.h +3 -0
index f02bd7a..a0ddf38 100644
@@ -1,2 +1,5 @@
+#define DEFINE_PROP_TADDR(_n, _s, _f, _d)                               \
+    DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_taddr, target_phys_addr_t)
+
 extern PropertyInfo qdev_prop_taddr;
 void qdev_prop_set_taddr(DeviceState *dev, const char *name, target_phys_addr_t value);
hw/qdev.h +38 -0
index b342afb..e2703f4 100644
@@ -156,6 +156,44 @@ extern PropertyInfo qdev_prop_ptr;
 extern PropertyInfo qdev_prop_macaddr;
 extern PropertyInfo qdev_prop_pci_devfn;
 
+#define typeof_field(type, field) typeof(((type *)0)->field)
+#define type_check(t1,t2) ((t1*)0 - (t2*)0)
+
+#define DEFINE_PROP(_name, _state, _field, _prop, _type) { \
+        .name      = (_name),                                    \
+        .info      = &(_prop),                                   \
+        .offset    = offsetof(_state, _field)                    \
+            + type_check(_type,typeof_field(_state, _field)),    \
+        }
+#define DEFINE_PROP_DEFAULT(_name, _state, _field, _defval, _prop, _type) { \
+        .name      = (_name),                                           \
+        .info      = &(_prop),                                          \
+        .offset    = offsetof(_state, _field)                           \
+            + type_check(_type,typeof_field(_state, _field)),           \
+        .defval    = (_type[]) { _defval },                             \
+        }
+
+#define DEFINE_PROP_UINT16(_n, _s, _f, _d)                      \
+    DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_uint16, uint16_t)
+#define DEFINE_PROP_UINT32(_n, _s, _f, _d)                      \
+    DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_uint32, uint32_t)
+#define DEFINE_PROP_UINT64(_n, _s, _f, _d)                      \
+    DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_uint64, uint64_t)
+#define DEFINE_PROP_HEX32(_n, _s, _f, _d)                       \
+    DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_hex32, uint32_t)
+#define DEFINE_PROP_HEX64(_n, _s, _f, _d)                       \
+    DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_hex64, uint64_t)
+#define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d)                   \
+    DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_pci_devfn, uint32_t)
+
+#define DEFINE_PROP_PTR(_n, _s, _f)             \
+    DEFINE_PROP(_n, _s, _f, qdev_prop_ptr, void*)
+#define DEFINE_PROP_MACADDR(_n, _s, _f)         \
+    DEFINE_PROP(_n, _s, _f, qdev_prop_macaddr, uint8_t[6])
+
+#define DEFINE_PROP_END_OF_LIST()               \
+    {}
+
 /* Set properties between creation and init.  */
 void *qdev_get_prop_ptr(DeviceState *dev, Property *prop);
 int qdev_prop_parse(DeviceState *dev, const char *name, const char *value);
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH 2/32 qdev/prop: add CharDriverState property.

In reply to Gerd Hoffmann
---
 hw/qdev-properties.c |   20 ++++++++++++++++++++
 hw/qdev.h            |    6 ++++++
 2 files changed, 26 insertions(+), 0 deletions(-)
hw/qdev-properties.c +20 -0
index 0e4878e..7edb6b7 100644
@@ -141,6 +141,21 @@ PropertyInfo qdev_prop_hex64 = {
     .print = print_hex64,
 };
 
+/* --- character device --- */
+
+static int print_chr(DeviceState *dev, Property *prop, char *dest, size_t len)
+{
+    CharDriverState **ptr = qdev_get_prop_ptr(dev, prop);
+    return snprintf(dest, len, "%s", (*ptr)->label);
+}
+
+PropertyInfo qdev_prop_chr = {
+    .name  = "chr",
+    .type  = PROP_TYPE_CHR,
+    .size  = sizeof(CharDriverState*),
+    .print = print_chr,
+};
+
 /* --- pointer --- */
 
 static int print_ptr(DeviceState *dev, Property *prop, char *dest, size_t len)
@@ -325,6 +340,11 @@ void qdev_prop_set_uint64(DeviceState *dev, const char *name, uint64_t value)
     qdev_prop_set(dev, name, &value, PROP_TYPE_UINT64);
 }
 
+void qdev_prop_set_chr(DeviceState *dev, const char *name, CharDriverState *value)
+{
+    qdev_prop_set(dev, name, &value, PROP_TYPE_CHR);
+}
+
 void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value)
 {
     qdev_prop_set(dev, name, &value, PROP_TYPE_PTR);
hw/qdev.h +6 -0
index e2703f4..bff13fa 100644
@@ -3,6 +3,7 @@
 
 #include "hw.h"
 #include "sys-queue.h"
+#include "qemu-char.h"
 
 typedef struct Property Property;
 
@@ -62,6 +63,7 @@ enum PropertyType {
     PROP_TYPE_UINT64,
     PROP_TYPE_TADDR,
     PROP_TYPE_MACADDR,
+    PROP_TYPE_CHR,
     PROP_TYPE_PTR,
 };
 
@@ -152,6 +154,7 @@ extern PropertyInfo qdev_prop_uint32;
 extern PropertyInfo qdev_prop_uint64;
 extern PropertyInfo qdev_prop_hex32;
 extern PropertyInfo qdev_prop_hex64;
+extern PropertyInfo qdev_prop_chr;
 extern PropertyInfo qdev_prop_ptr;
 extern PropertyInfo qdev_prop_macaddr;
 extern PropertyInfo qdev_prop_pci_devfn;
@@ -188,6 +191,8 @@ extern PropertyInfo qdev_prop_pci_devfn;
 
 #define DEFINE_PROP_PTR(_n, _s, _f)             \
     DEFINE_PROP(_n, _s, _f, qdev_prop_ptr, void*)
+#define DEFINE_PROP_CHR(_n, _s, _f)             \
+    DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharDriverState*)
 #define DEFINE_PROP_MACADDR(_n, _s, _f)         \
     DEFINE_PROP(_n, _s, _f, qdev_prop_macaddr, uint8_t[6])
 
@@ -201,6 +206,7 @@ void qdev_prop_set(DeviceState *dev, const char *name, void *src, enum PropertyT
 void qdev_prop_set_uint16(DeviceState *dev, const char *name, uint16_t value);
 void qdev_prop_set_uint32(DeviceState *dev, const char *name, uint32_t value);
 void qdev_prop_set_uint64(DeviceState *dev, const char *name, uint64_t value);
+void qdev_prop_set_chr(DeviceState *dev, const char *name, CharDriverState *value);
 /* FIXME: Remove opaque pointer properties.  */
 void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value);
 void qdev_prop_set_defaults(DeviceState *dev, Property *props);
Signature · 1 line
1.6.2.5
#5 lore raw

PATCH 5/32 qdev/prop: convert armv7m.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/armv7m.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
hw/armv7m.c +2 -6
index 2e66d7e..2e4f0ed 100644
@@ -242,12 +242,8 @@ static SysBusDeviceInfo bitband_info = {
     .qdev.name  = "ARM,bitband-memory",
     .qdev.size  = sizeof(BitBandState),
     .qdev.props = (Property[]) {
-        {
-            .name   = "base",
-            .info   = &qdev_prop_hex32,
-            .offset = offsetof(BitBandState, base),
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("base", BitBandState, base, 0),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#14 lore raw

PATCH 14/32 qdev/prop: convert qdev.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/qdev.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/qdev.c +2 -2
index 9488dba..3de3bc9 100644
@@ -543,8 +543,8 @@ static void qdev_print_props(Monitor *mon, DeviceState *dev, Property *props,
     if (!props)
         return;
     while (props->name) {
-        if (props->info->print) {
-            props->info->print(dev, props, buf, sizeof(buf));
+        if (props->xinfo->print) {
+            props->xinfo->print(dev, props, buf, sizeof(buf));
             qdev_printf("%s-prop: %s = %s\n", prefix, props->name, buf);
         }
         props++;
Signature · 1 line
1.6.2.5
#6 lore raw

PATCH 6/32 qdev/prop: convert eccmemctl.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/eccmemctl.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
hw/eccmemctl.c +2 -7
index dca397d..3f38477 100644
@@ -356,13 +356,8 @@ static SysBusDeviceInfo ecc_info = {
     .qdev.name  = "eccmemctl",
     .qdev.size  = sizeof(ECCState),
     .qdev.props = (Property[]) {
-        {
-            .name   = "version",
-            .info   = &qdev_prop_hex32,
-            .offset = offsetof(ECCState, version),
-            .defval = (uint32_t[]) { -1 },
-        },
-        {/* end of list */}
+        DEFINE_PROP_HEX32("version", ECCState, version, -1),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#10 lore raw

PATCH 10/32 qdev/prop: convert integratorcp.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/integratorcp.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
hw/integratorcp.c +2 -6
index ddc8d85..2d83004 100644
@@ -526,12 +526,8 @@ static SysBusDeviceInfo core_info = {
     .qdev.name  = "integrator_core",
     .qdev.size  = sizeof(integratorcm_state),
     .qdev.props = (Property[]) {
-        {
-            .name   = "memsz",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(integratorcm_state, memsz),
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("memsz", integratorcm_state, memsz, 0),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#9 lore raw

PATCH 9/32 qdev/prop: convert i2c.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/i2c.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
hw/i2c.c +2 -6
index 42a5d7a..7a1b358 100644
@@ -21,12 +21,8 @@ static struct BusInfo i2c_bus_info = {
     .name = "I2C",
     .size = sizeof(i2c_bus),
     .props = (Property[]) {
-        {
-            .name   = "address",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(struct i2c_slave, address),
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("address", struct i2c_slave, address, 0),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#4 lore raw

PATCH 4/32 qdev/prop: convert arm_sysctl.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/arm_sysctl.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
hw/arm_sysctl.c +2 -6
index bb005c8..11b3787 100644
@@ -219,12 +219,8 @@ static SysBusDeviceInfo arm_sysctl_info = {
     .qdev.name  = "realview_sysctl",
     .qdev.size  = sizeof(arm_sysctl_state),
     .qdev.props = (Property[]) {
-        {
-            .name   = "sys_id",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(arm_sysctl_state, sys_id),
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("sys_id", arm_sysctl_state, sys_id, 0),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#8 lore raw

PATCH 8/32 qdev/prop: convert etraxfs_pic.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/etraxfs_pic.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
hw/etraxfs_pic.c +5 -8
index e627218..4527d98 100644
@@ -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(),
     }
 };
 
Signature · 1 line
1.6.2.5
#11 lore raw

PATCH 11/32 qdev/prop: convert iommu.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/iommu.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
hw/iommu.c +2 -6
index d73dad3..a1c54f8 100644
@@ -404,12 +404,8 @@ static SysBusDeviceInfo iommu_info = {
     .qdev.name  = "iommu",
     .qdev.size  = sizeof(IOMMUState),
     .qdev.props = (Property[]) {
-        {
-            .name = "version",
-            .info = &qdev_prop_hex32,
-            .offset = offsetof(IOMMUState, version),
-        },
-        {/* end of property list */}
+        DEFINE_PROP_HEX32("version", IOMMUState, version, 0),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#24 lore raw

PATCH 22/32 qdev/prop: convert syborg_interrupt.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/syborg_interrupt.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
hw/syborg_interrupt.c +2 -7
index a372ec1..1b44989 100644
@@ -222,13 +222,8 @@ static SysBusDeviceInfo syborg_int_info = {
     .qdev.name  = "syborg,interrupt",
     .qdev.size  = sizeof(SyborgIntState),
     .qdev.props = (Property[]) {
-        {
-            .name   = "num-interrupts",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(SyborgIntState, num_irqs),
-            .defval = (uint32_t[]) { 64 },
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("num-interrupts", SyborgIntState, num_irqs, 64),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#26 lore raw

PATCH 24/32 qdev/prop: convert syborg_pointer.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/syborg_pointer.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
hw/syborg_pointer.c +3 -12
index edd1f22..152602a 100644
@@ -227,18 +227,9 @@ static SysBusDeviceInfo syborg_pointer_info = {
     .qdev.name  = "syborg,pointer",
     .qdev.size  = sizeof(SyborgPointerState),
     .qdev.props = (Property[]) {
-        {
-            .name   = "fifo-size",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(SyborgPointerState, fifo_size),
-            .defval = (uint32_t[]) { 16 },
-        },{
-            .name   = "absolute",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(SyborgPointerState, absolute),
-            .defval = (uint32_t[]) { 1 },
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("fifo-size", SyborgPointerState, fifo_size, 16),
+        DEFINE_PROP_UINT32("absolute",  SyborgPointerState, absolute,   1),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#25 lore raw

PATCH 23/32 qdev/prop: convert syborg_keyboard.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/syborg_keyboard.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
hw/syborg_keyboard.c +2 -7
index ffc85a5..deece3c 100644
@@ -229,13 +229,8 @@ static SysBusDeviceInfo syborg_keyboard_info = {
     .qdev.name  = "syborg,keyboard",
     .qdev.size  = sizeof(SyborgKeyboardState),
     .qdev.props = (Property[]) {
-        {
-            .name   = "fifo-size",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(SyborgKeyboardState, fifo_size),
-            .defval = (uint32_t[]) { 16 },
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("fifo-size", SyborgKeyboardState, fifo_size, 16),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#12 lore raw

PATCH 12/32 qdev/prop: convert m48t59.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/m48t59.c |   20 ++++----------------
 1 files changed, 4 insertions(+), 16 deletions(-)
hw/m48t59.c +4 -16
index 7e53dce..6541cbe 100644
@@ -668,22 +668,10 @@ static SysBusDeviceInfo m48t59_info = {
     .qdev.name  = "m48t59",
     .qdev.size  = sizeof(m48t59_t),
     .qdev.props = (Property[]) {
-        {
-            .name   = "size",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(m48t59_t, size),
-            .defval = (uint32_t[]) { -1 },
-        },{
-            .name   = "type",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(m48t59_t, type),
-            .defval = (uint32_t[]) { -1 },
-        },{
-            .name   = "io_base",
-            .info   = &qdev_prop_hex32,
-            .offset = offsetof(m48t59_t, io_base),
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("size",    m48t59_t, size,    -1),
+        DEFINE_PROP_UINT32("type",    m48t59_t, type,    -1),
+        DEFINE_PROP_HEX32( "io_base", m48t59_t, io_base,  0),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#18 lore raw

PATCH 16/32 qdev/prop: convert slavio_timer.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/slavio_timer.c |   22 ++++++----------------
 1 files changed, 6 insertions(+), 16 deletions(-)
hw/slavio_timer.c +6 -16
index 69c9f3b..131e903 100644
@@ -61,6 +61,7 @@ typedef struct SLAVIO_TIMERState {
     // processor only
     uint32_t running;
     struct SLAVIO_TIMERState *master;
+    void *m;
     uint32_t slave_index;
     // system only
     uint32_t num_slaves;
@@ -395,6 +396,7 @@ static void slavio_timer_init1(SysBusDevice *dev)
 
     sysbus_init_irq(dev, &s->irq);
 
+    s->master = s->m; /* hack alert: ptr property */
     if (!s->master || s->slave_index < s->master->num_slaves) {
         bh = qemu_bh_new(slavio_timer_irq, s);
         s->timer = ptimer_init(bh);
@@ -436,22 +438,10 @@ static SysBusDeviceInfo slavio_timer_info = {
     .qdev.name  = "slavio_timer",
     .qdev.size  = sizeof(SLAVIO_TIMERState),
     .qdev.props = (Property[]) {
-        {
-            .name = "num_slaves",
-            .info = &qdev_prop_uint32,
-            .offset = offsetof(SLAVIO_TIMERState, num_slaves),
-        },
-        {
-            .name = "slave_index",
-            .info = &qdev_prop_uint32,
-            .offset = offsetof(SLAVIO_TIMERState, slave_index),
-        },
-        {
-            .name = "master",
-            .info = &qdev_prop_ptr,
-            .offset = offsetof(SLAVIO_TIMERState, master),
-        },
-        {/* end of property list */}
+        DEFINE_PROP_UINT32("num_slaves",  SLAVIO_TIMERState, num_slaves,  0),
+        DEFINE_PROP_UINT32("slave_index", SLAVIO_TIMERState, slave_index, 0),
+        DEFINE_PROP_PTR("master",         SLAVIO_TIMERState, m),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#20 lore raw

PATCH 18/32 qdev/prop: convert sparc32_dma.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/sparc32_dma.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
hw/sparc32_dma.c +2 -6
index 7633905..926fd32 100644
@@ -286,12 +286,8 @@ static SysBusDeviceInfo sparc32_dma_info = {
     .qdev.name  = "sparc32_dma",
     .qdev.size  = sizeof(DMAState),
     .qdev.props = (Property[]) {
-        {
-            .name = "iommu_opaque",
-            .info = &qdev_prop_ptr,
-            .offset = offsetof(DMAState, iommu),
-        },
-        {/* end of property list */}
+        DEFINE_PROP_PTR("iommu_opaque", DMAState, iommu),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#7 lore raw

PATCH 7/32 qdev/prop: convert escc.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/escc.c |   47 ++++++++++-------------------------------------
 1 files changed, 10 insertions(+), 37 deletions(-)
hw/escc.c +10 -37
index 2264f5d..74a96cd 100644
@@ -118,7 +118,7 @@ typedef struct ChannelState {
 struct SerialState {
     SysBusDevice busdev;
     struct ChannelState chn[2];
-    int it_shift;
+    uint32_t it_shift;
     int mmio_index;
     uint32_t disabled;
     uint32_t frequency;
@@ -952,42 +952,15 @@ static SysBusDeviceInfo escc_info = {
     .qdev.name  = "escc",
     .qdev.size  = sizeof(SerialState),
     .qdev.props = (Property[]) {
-        {
-            .name = "frequency",
-            .info = &qdev_prop_uint32,
-            .offset = offsetof(SerialState, frequency),
-        },
-        {
-            .name = "it_shift",
-            .info = &qdev_prop_uint32,
-            .offset = offsetof(SerialState, it_shift),
-        },
-        {
-            .name = "disabled",
-            .info = &qdev_prop_uint32,
-            .offset = offsetof(SerialState, disabled),
-        },
-        {
-            .name = "chrB",
-            .info = &qdev_prop_ptr,
-            .offset = offsetof(SerialState, chn[0].chr),
-        },
-        {
-            .name = "chrA",
-            .info = &qdev_prop_ptr,
-            .offset = offsetof(SerialState, chn[1].chr),
-        },
-        {
-            .name = "chnBtype",
-            .info = &qdev_prop_uint32,
-            .offset = offsetof(SerialState, chn[0].type),
-        },
-        {
-            .name = "chnAtype",
-            .info = &qdev_prop_uint32,
-            .offset = offsetof(SerialState, chn[1].type),
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("frequency", SerialState, frequency,   0),
+        DEFINE_PROP_UINT32("it_shift",  SerialState, it_shift,    0),
+        DEFINE_PROP_UINT32("disabled",  SerialState, disabled,    0),
+        DEFINE_PROP_UINT32("disabled",  SerialState, disabled,    0),
+        DEFINE_PROP_UINT32("chnBtype",  SerialState, chn[0].type, 0),
+        DEFINE_PROP_UINT32("chnAtype",  SerialState, chn[1].type, 0),
+        DEFINE_PROP_CHR("chrB", SerialState, chn[0].chr),
+        DEFINE_PROP_CHR("chrA", SerialState, chn[1].chr),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#17 lore raw

PATCH 15/32 qdev/prop: convert slavio_intctl.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/slavio_intctl.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)
hw/slavio_intctl.c +5 -11
index 188511e..01a7624 100644
@@ -68,6 +68,7 @@ typedef struct SLAVIO_INTCTLState {
 #endif
     qemu_irq cpu_irqs[MAX_CPUS][MAX_PILS];
     const uint32_t *intbit_to_level;
+    void *i_to_l;
     uint32_t cputimer_lbit, cputimer_mbit;
     uint32_t cputimer_bit;
     uint32_t pil_out[MAX_CPUS];
@@ -392,6 +393,7 @@ static void slavio_intctl_init1(SysBusDevice *dev)
     int io_memory;
     unsigned int i, j;
 
+    s->intbit_to_level = s->i_to_l; /* hack alert: ptr property */
     qdev_init_gpio_in(&dev->qdev, slavio_set_irq_all, 32 + MAX_CPUS);
     io_memory = cpu_register_io_memory(slavio_intctlm_mem_read,
                                        slavio_intctlm_mem_write, s);
@@ -450,17 +452,9 @@ static SysBusDeviceInfo slavio_intctl_info = {
     .qdev.name  = "slavio_intctl",
     .qdev.size  = sizeof(SLAVIO_INTCTLState),
     .qdev.props = (Property[]) {
-        {
-            .name = "intbit_to_level",
-            .info = &qdev_prop_ptr,
-            .offset = offsetof(SLAVIO_INTCTLState, intbit_to_level),
-        },
-        {
-            .name = "cputimer_bit",
-            .info = &qdev_prop_uint32,
-            .offset = offsetof(SLAVIO_INTCTLState, cputimer_bit),
-        },
-        {/* end of property list */}
+        DEFINE_PROP_PTR("intbit_to_level", SLAVIO_INTCTLState, i_to_l),
+        DEFINE_PROP_UINT32("cputimer_bit", SLAVIO_INTCTLState, cputimer_bit, 0),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#21 lore raw

PATCH 19/32 qdev/prop: convert sun4m.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/sun4m.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
hw/sun4m.c +2 -6
index 274ee35..6a59627 100644
@@ -525,12 +525,8 @@ static SysBusDeviceInfo ram_info = {
     .qdev.name  = "memory",
     .qdev.size  = sizeof(RamDevice),
     .qdev.props = (Property[]) {
-        {
-            .name = "size",
-            .info = &qdev_prop_uint64,
-            .offset = offsetof(RamDevice, size),
-        },
-        {/* end of property list */}
+        DEFINE_PROP_UINT64("size", RamDevice, size, 0),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#30 lore raw

PATCH 28/32 qdev/prop: convert vga.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/vga.c     |   13 +++----------
 hw/vga_int.h |    4 ++--
 2 files changed, 5 insertions(+), 12 deletions(-)
hw/vga.c +3 -10
index 4d74ffe..25e5d6c 100644
@@ -2533,16 +2533,9 @@ static PCIDeviceInfo vga_info = {
     .init         = pci_vga_initfn,
     .config_write = pci_vga_write_config,
     .qdev.props   = (Property[]) {
-        {
-            .name   = "bios-offset",
-            .info   = &qdev_prop_hex32,
-            .offset = offsetof(PCIVGAState, vga_state.bios_offset),
-        },{
-            .name   = "bios-size",
-            .info   = &qdev_prop_hex32,
-            .offset = offsetof(PCIVGAState, vga_state.bios_size),
-        },
-        {/* end of list */}
+        DEFINE_PROP_HEX32("bios-offset", PCIVGAState, vga_state.bios_offset, 0),
+        DEFINE_PROP_HEX32("bios-size",   PCIVGAState, vga_state.bios_size,   0),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
hw/vga_int.h +2 -2
index 631b1b0..651e6f3 100644
@@ -107,8 +107,8 @@ typedef struct VGACommonState {
     uint32_t map_addr;
     uint32_t map_end;
     uint32_t lfb_vram_mapped; /* whether 0xa0000 is mapped as ram */
-    unsigned long bios_offset;
-    unsigned int bios_size;
+    uint32_t bios_offset;
+    uint32_t bios_size;
     int it_shift;
     PCIDevice *pci_dev;
     uint32_t latch;
Signature · 1 line
1.6.2.5
#31 lore raw

PATCH 29/32 qdev/prop: convert virtio-pci.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/virtio-pci.c |   26 +++++++-------------------
 1 files changed, 7 insertions(+), 19 deletions(-)
hw/virtio-pci.c +7 -19
index 703f4fe..d05970f 100644
@@ -498,37 +498,25 @@ static PCIDeviceInfo virtio_info[] = {
         .qdev.size = sizeof(VirtIOPCIProxy),
         .init      = virtio_blk_init_pci,
         .qdev.props = (Property[]) {
-            {
-                .name   = "class",
-                .info   = &qdev_prop_hex32,
-                .offset = offsetof(VirtIOPCIProxy, class_code),
-            },
-            {/* end of list */}
+            DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
+            DEFINE_PROP_END_OF_LIST(),
         },
     },{
         .qdev.name  = "virtio-net-pci",
         .qdev.size  = sizeof(VirtIOPCIProxy),
         .init       = virtio_net_init_pci,
         .qdev.props = (Property[]) {
-            {
-                .name   = "vectors",
-                .info   = &qdev_prop_uint32,
-                .offset = offsetof(VirtIOPCIProxy, nvectors),
-                .defval = (uint32_t[]) { NIC_NVECTORS_UNSPECIFIED },
-            },
-            {/* end of list */}
+            DEFINE_PROP_HEX32("vectors", VirtIOPCIProxy, nvectors,
+                              NIC_NVECTORS_UNSPECIFIED),
+            DEFINE_PROP_END_OF_LIST(),
         },
     },{
         .qdev.name = "virtio-console-pci",
         .qdev.size = sizeof(VirtIOPCIProxy),
         .init      = virtio_console_init_pci,
         .qdev.props = (Property[]) {
-            {
-                .name   = "class",
-                .info   = &qdev_prop_hex32,
-                .offset = offsetof(VirtIOPCIProxy, class_code),
-            },
-            {/* end of list */}
+            DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
+            DEFINE_PROP_END_OF_LIST(),
         },
     },{
         .qdev.name = "virtio-balloon-pci",
Signature · 1 line
1.6.2.5
#33 lore raw

PATCH 31/32 qdev/prop: convert xilinx_intc.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/xilinx_intc.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
hw/xilinx_intc.c +2 -6
index 3f08bf8..7fadad5 100644
@@ -162,12 +162,8 @@ static SysBusDeviceInfo xilinx_intc_info = {
     .qdev.name  = "xilinx,intc",
     .qdev.size  = sizeof(struct xlx_pic),
     .qdev.props = (Property[]) {
-        {
-            .name   = "kind-of-intr",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(struct xlx_pic, c_kind_of_intr),
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("kind-of-intr", struct xlx_pic, c_kind_of_intr, 0),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#19 lore raw

PATCH 17/32 qdev/prop: convert smbus_eeprom.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/smbus_eeprom.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
hw/smbus_eeprom.c +5 -8
index c071fb1..9785cc2 100644
@@ -30,7 +30,7 @@
 
 typedef struct SMBusEEPROMDevice {
     SMBusDevice smbusdev;
-    uint8_t *data;
+    void *data;
     uint8_t offset;
 } SMBusEEPROMDevice;
 
@@ -54,7 +54,8 @@ static void eeprom_send_byte(SMBusDevice *dev, uint8_t val)
 static uint8_t eeprom_receive_byte(SMBusDevice *dev)
 {
     SMBusEEPROMDevice *eeprom = (SMBusEEPROMDevice *) dev;
-    uint8_t val = eeprom->data[eeprom->offset++];
+    uint8_t *data = eeprom->data;
+    uint8_t val = data[eeprom->offset++];
 #ifdef DEBUG
     printf("eeprom_receive_byte: addr=0x%02x val=0x%02x\n",
            dev->i2c.address, val);
@@ -106,12 +107,8 @@ static SMBusDeviceInfo smbus_eeprom_info = {
     .i2c.qdev.name = "smbus-eeprom",
     .i2c.qdev.size = sizeof(SMBusEEPROMDevice),
     .i2c.qdev.props = (Property[]) {
-        {
-            .name   = "data",
-            .info   = &qdev_prop_ptr,
-            .offset = offsetof(SMBusEEPROMDevice, data),
-        },
-        {/* end of list */}
+        DEFINE_PROP_PTR("data", SMBusEEPROMDevice, data),
+        DEFINE_PROP_END_OF_LIST(),
     },
     .init = smbus_eeprom_init,
     .quick_cmd = eeprom_quick_cmd,
Signature · 1 line
1.6.2.5
#22 lore raw

PATCH 20/32 qdev/prop: convert sun4u.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/sun4u.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
hw/sun4u.c +2 -6
index 6f3f0c3..fc0c552 100644
@@ -492,12 +492,8 @@ static SysBusDeviceInfo ram_info = {
     .qdev.name  = "memory",
     .qdev.size  = sizeof(RamDevice),
     .qdev.props = (Property[]) {
-        {
-            .name = "size",
-            .info = &qdev_prop_uint64,
-            .offset = offsetof(RamDevice, size),
-        },
-        {/* end of property list */}
+        DEFINE_PROP_UINT64("size", RamDevice, size, 0),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#23 lore raw

PATCH 21/32 qdev/prop: convert syborg_fb.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/syborg_fb.c |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)
hw/syborg_fb.c +3 -10
index 2929ffd..efa5c0e 100644
@@ -535,16 +535,9 @@ static SysBusDeviceInfo syborg_fb_info = {
     .qdev.name  = "syborg,framebuffer",
     .qdev.size  = sizeof(SyborgFBState),
     .qdev.props = (Property[]) {
-        {
-            .name   = "width",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(SyborgFBState, cols),
-        },{
-            .name   = "height",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(SyborgFBState, rows),
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("width",  SyborgFBState, cols, 0),
+        DEFINE_PROP_UINT32("height", SyborgFBState, rows, 0),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#27 lore raw

PATCH 25/32 qdev/prop: convert syborg_serial.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/syborg_serial.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
hw/syborg_serial.c +2 -7
index f693421..f1c6c7e 100644
@@ -344,13 +344,8 @@ static SysBusDeviceInfo syborg_serial_info = {
     .qdev.name  = "syborg,serial",
     .qdev.size  = sizeof(SyborgSerialState),
     .qdev.props = (Property[]) {
-        {
-            .name   = "fifo-size",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(SyborgSerialState, fifo_size),
-            .defval = (uint32_t[]) { 16 },
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("fifo-size", SyborgSerialState, fifo_size, 16),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#29 lore raw

PATCH 27/32 qdev/prop: convert tcx.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/tcx.c |   33 ++++++---------------------------
 1 files changed, 6 insertions(+), 27 deletions(-)
hw/tcx.c +6 -27
index c592524..e6c1824 100644
@@ -679,33 +679,12 @@ static SysBusDeviceInfo tcx_info = {
     .qdev.name  = "SUNW,tcx",
     .qdev.size  = sizeof(TCXState),
     .qdev.props = (Property[]) {
-        {
-            .name   = "addr",
-            .info   = &qdev_prop_taddr,
-            .offset = offsetof(TCXState, addr),
-            .defval = (target_phys_addr_t[]) { -1 },
-        },{
-            .name   = "vram_size",
-            .info   = &qdev_prop_hex32,
-            .offset = offsetof(TCXState, vram_size),
-            .defval = (uint32_t[]) { -1 },
-        },{
-            .name   = "width",
-            .info   = &qdev_prop_uint16,
-            .offset = offsetof(TCXState, width),
-            .defval = (uint16_t[]) { -1 },
-        },{
-            .name   = "height",
-            .info   = &qdev_prop_uint16,
-            .offset = offsetof(TCXState, height),
-            .defval = (uint16_t[]) { -1 },
-        },{
-            .name   = "depth",
-            .info   = &qdev_prop_uint16,
-            .offset = offsetof(TCXState, depth),
-            .defval = (uint16_t[]) { -1 },
-        },
-        {/* end of list */}
+        DEFINE_PROP_TADDR("addr",      TCXState, addr,      -1),
+        DEFINE_PROP_HEX32("vram_size", TCXState, vram_size, -1),
+        DEFINE_PROP_UINT16("width",    TCXState, width,     -1),
+        DEFINE_PROP_UINT16("height",   TCXState, height,    -1),
+        DEFINE_PROP_UINT16("depth",    TCXState, depth,     -1),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#32 lore raw

PATCH 30/32 qdev/prop: convert xilinx_ethlite.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/xilinx_ethlite.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
hw/xilinx_ethlite.c +3 -12
index b3fd25b..f981d10 100644
@@ -228,18 +228,9 @@ static SysBusDeviceInfo xilinx_ethlite_info = {
     .qdev.name  = "xilinx,ethlite",
     .qdev.size  = sizeof(struct xlx_ethlite),
     .qdev.props = (Property[]) {
-        {
-            .name   = "txpingpong",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(struct xlx_ethlite, c_tx_pingpong),
-            .defval = (uint32_t[]) { 1 },
-        },{
-            .name   = "rxpingpong",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(struct xlx_ethlite, c_rx_pingpong),
-            .defval = (uint32_t[]) { 1 },
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("txpingpong", struct xlx_ethlite, c_tx_pingpong, 1),
+        DEFINE_PROP_UINT32("rxpingpong", struct xlx_ethlite, c_rx_pingpong, 1),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#34 lore raw

PATCH 32/32 qdev/prop: convert xilinx_timer.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/xilinx_timer.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
hw/xilinx_timer.c +3 -12
index efb6a04..196f011 100644
@@ -219,18 +219,9 @@ static SysBusDeviceInfo xilinx_timer_info = {
     .qdev.name  = "xilinx,timer",
     .qdev.size  = sizeof(struct timerblock),
     .qdev.props = (Property[]) {
-        {
-            .name   = "frequency",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(struct timerblock, freq_hz),
-            .defval = (uint32_t[]) { 2 },
-        },{
-            .name   = "nr-timers",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(struct timerblock, nr_timers),
-            .defval = (uint32_t[]) { 2 },
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("frequency", struct timerblock, freq_hz,   0),
+        DEFINE_PROP_UINT32("nr-timers", struct timerblock, nr_timers, 0),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#13 lore raw

PATCH 13/32 qdev/prop: convert pcnet.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/pcnet.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
hw/pcnet.c +2 -6
index 22ab6be..637dcfb 100644
@@ -2145,12 +2145,8 @@ static SysBusDeviceInfo lance_info = {
     .qdev.name  = "lance",
     .qdev.size  = sizeof(SysBusPCNetState),
     .qdev.props = (Property[]) {
-        {
-            .name   = "dma",
-            .info   = &qdev_prop_ptr,
-            .offset = offsetof(SysBusPCNetState, state.dma_opaque),
-        },
-        {/* end of list */}
+        DEFINE_PROP_PTR("dma", SysBusPCNetState, state.dma_opaque),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#28 lore raw

PATCH 26/32 qdev/prop: convert syborg_timer.c to helper macros.

In reply to Gerd Hoffmann
---
 hw/syborg_timer.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
hw/syborg_timer.c +2 -6
index cf96c5f..f64b824 100644
@@ -230,12 +230,8 @@ static SysBusDeviceInfo syborg_timer_info = {
     .qdev.name  = "syborg,timer",
     .qdev.size  = sizeof(SyborgTimerState),
     .qdev.props = (Property[]) {
-        {
-            .name   = "frequency",
-            .info   = &qdev_prop_uint32,
-            .offset = offsetof(SyborgTimerState, freq),
-        },
-        {/* end of list */}
+        DEFINE_PROP_UINT32("frequency",SyborgTimerState, freq, 0),
+        DEFINE_PROP_END_OF_LIST(),
     }
 };
 
Signature · 1 line
1.6.2.5
#15 lore raw

Re: [Qemu-devel] [PATCH 14/32] qdev/prop: convert qdev.c to helper macros.

In reply to Gerd Hoffmann
Quoted 11 lines · Gerd Hoffmann
---
 hw/qdev.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/qdev.c +0 -0
index 9488dba..3de3bc9 100644

hw/qdev.c static void qdev_print_props(Monitor *mon, DeviceState *dev, Property *props, · line 550

Quoted 10 lines
hw/qdev.c +2 -2
@@ -543,8 +543,8 @@ static void qdev_print_props(Monitor *mon, DeviceState *dev, Property *props,
     if (!props)
         return;
     while (props->name) {
-        if (props->info->print) {
-            props->info->print(dev, props, buf, sizeof(buf));
+        if (props->xinfo->print) {
+            props->xinfo->print(dev, props, buf, sizeof(buf));
             qdev_printf("%s-prop: %s = %s\n", prefix, props->name, buf);
         }
         props++;

This doesn't match the description and breaks the build for me.

Regards,

Anthony Liguori

#16 lore raw

Re: [Qemu-devel] [PATCH 14/32] qdev/prop: convert qdev.c to helper macros.

Quoted 15 lines · Anthony Liguori
Quoted 14 lines · Gerd Hoffmann

---
hw/qdev.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
hw/qdev.c +0 -0
index 9488dba..3de3bc9 100644
@@ -543,8 +543,8 @@ static void qdev_print_props(Monitor *mon,
 DeviceState *dev, Property *props,
 if (!props)
 return;
 while (props->name) {
Quoted 8 lines
Quoted 7 lines
hw/qdev.c +2 -2
- if (props->info->print) {
- props->info->print(dev, props, buf, sizeof(buf));
+ if (props->xinfo->print) {
+ props->xinfo->print(dev, props, buf, sizeof(buf));
 qdev_printf("%s-prop: %s = %s\n", prefix, props->name, buf);
 }

props++;

This doesn't match the description and breaks the build for me.

Indeed. Just drop that patch.

It is part of a little temporary patch to make gcc complain about any not-yet converted property. It wasn't intended to sneak into public ...

cheers,
Gerd