Patchwork [01/14] qdev: fix adding of ptr properties

login
register
mail settings
Submitter Anthony Liguori
Date April 18, 2012, 8:56 p.m.
Message ID <1334782613-5421-2-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/153587/
State New
Headers show

Comments

Anthony Liguori - April 18, 2012, 8:56 p.m.
ptr properties have neither a get/set or a print/parse which means that when
they're added they aren't treated as static or legacy properties.

Just assume properties like this are legacy properties and treat them as such.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/qdev.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Patch

diff --git a/hw/qdev.c b/hw/qdev.c
index afbc975..83a1db6 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -575,9 +575,12 @@  void qdev_property_add_legacy(DeviceState *dev, Property *prop,
 {
     gchar *name, *type;
 
-    if (!prop->info->print && !prop->info->parse) {
+    /* Register pointer properties as legacy properties */
+    if (!prop->info->print && !prop->info->parse &&
+        (prop->info->set || prop->info->get)) {
         return;
     }
+
     name = g_strdup_printf("legacy-%s", prop->name);
     type = g_strdup_printf("legacy<%s>",
                            prop->info->legacy_name ?: prop->info->name);