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>
This commit is contained in:
Eduardo Habkost 2020-12-11 17:05:17 -05:00
parent 991f0ac901
commit 23a1dae8c1

View File

@ -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); ObjectClass *oc = OBJECT_CLASS(klass);
@ -897,7 +898,7 @@ static void qdev_class_add_property(DeviceClass *klass, Property *prop)
ObjectProperty *op; ObjectProperty *op;
op = object_class_property_add(oc, op = object_class_property_add(oc,
prop->name, prop->info->name, name, prop->info->name,
prop->info->get, prop->info->set, prop->info->get, prop->info->set,
prop->info->release, prop->info->release,
prop); prop);
@ -905,7 +906,7 @@ static void qdev_class_add_property(DeviceClass *klass, Property *prop)
prop->info->set_default_value(op, 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); prop->info->description);
} }
@ -962,7 +963,7 @@ void device_class_set_props(DeviceClass *dc, Property *props)
dc->props_ = props; dc->props_ = props;
for (prop = props; prop && prop->name; prop++) { for (prop = props; prop && prop->name; prop++) {
qdev_class_add_legacy_property(dc, prop); qdev_class_add_legacy_property(dc, prop);
qdev_class_add_property(dc, prop); qdev_class_add_property(dc, prop->name, prop);
} }
} }