summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo Habkost2020-12-11 23:05:17 +0100
committerEduardo Habkost2020-12-18 21:20:17 +0100
commit23a1dae8c16e7e9e728dc8ae2daaece974bd7d01 (patch)
tree8510afe36abd72be923e9bd4264d3d95c9094970
parentqdev: Avoid using prop->name unnecessarily (diff)
downloadqemu-23a1dae8c16e7e9e728dc8ae2daaece974bd7d01.tar.gz
qemu-23a1dae8c16e7e9e728dc8ae2daaece974bd7d01.tar.xz
qemu-23a1dae8c16e7e9e728dc8ae2daaece974bd7d01.zip
qdev: Add name parameter to qdev_class_add_property()
This will make it easier to remove Property.name in the future. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20201211220529.2290218-21-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
-rw-r--r--hw/core/qdev-properties.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 50734a1cd4..457c7fe4ba 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -887,7 +887,8 @@ void qdev_property_add_static(DeviceState *dev, Property *prop)
}
}
-static void qdev_class_add_property(DeviceClass *klass, Property *prop)
+static void qdev_class_add_property(DeviceClass *klass, const char *name,
+ Property *prop)
{
ObjectClass *oc = OBJECT_CLASS(klass);
@@ -897,7 +898,7 @@ static void qdev_class_add_property(DeviceClass *klass, Property *prop)
ObjectProperty *op;
op = object_class_property_add(oc,
- prop->name, prop->info->name,
+ name, prop->info->name,
prop->info->get, prop->info->set,
prop->info->release,
prop);
@@ -905,7 +906,7 @@ static void qdev_class_add_property(DeviceClass *klass, Property *prop)
prop->info->set_default_value(op, prop);
}
}
- object_class_property_set_description(oc, prop->name,
+ object_class_property_set_description(oc, name,
prop->info->description);
}
@@ -962,7 +963,7 @@ void device_class_set_props(DeviceClass *dc, Property *props)
dc->props_ = props;
for (prop = props; prop && prop->name; prop++) {
qdev_class_add_legacy_property(dc, prop);
- qdev_class_add_property(dc, prop);
+ qdev_class_add_property(dc, prop->name, prop);
}
}