summaryrefslogtreecommitdiff
path: root/hw/qdev.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-02-02 09:47:13 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2012-02-07 13:52:41 +0100
commitd822979bdf80c3ea9752615af15f231b4c4ce547 (patch)
tree108ee38d18a61cf3550d2f24a70de6b601fd897d /hw/qdev.c
parent1d9c5a12cefcd914d99c32de9aac72966a4788ae (diff)
qdev: remove direct calls to print/parse
There's no need to call into ->parse and ->print manually. The QOM legacy properties do that for us. Furthermore, in some cases legacy and static properties have exactly the same behavior, and we could drop the legacy properties right away. Add an appropriate fallback to prepare for this. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r--hw/qdev.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index e3b53b7f62..acb7829b5d 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -581,6 +581,15 @@ void qdev_property_add_legacy(DeviceState *dev, Property *prop,
void qdev_property_add_static(DeviceState *dev, Property *prop,
Error **errp)
{
+ /*
+ * TODO qdev_prop_ptr does not have getters or setters. It must
+ * go now that it can be replaced with links. The test should be
+ * removed along with it: all static properties are read/write.
+ */
+ if (!prop->info->get && !prop->info->set) {
+ return;
+ }
+
object_property_add(OBJECT(dev), prop->name, prop->info->name,
prop->info->get, prop->info->set,
NULL,