aboutsummaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-05-01 16:03:19 +0200
committerAndreas Färber <afaerber@suse.de>2013-05-06 19:50:52 +0200
commit868d378bb087c6003bfa0e431aec0e5871a90ff4 (patch)
tree5a7a2e8d78abf3c5d90af24509df23d0313d2eba /hw/core
parentb1fe9bcbceb6fb9d800f735da37aa79ac4552c6e (diff)
qdev: Introduce qdev_prop_set_globals_for_type()
Reuse it in qdev_prop_set_globals(). Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> [AF: Renamed from qdev_prop_set_custom_globals()] Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/qdev-properties.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 716ba19a3c..3a324fb0c3 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1099,23 +1099,37 @@ void qdev_prop_register_global_list(GlobalProperty *props)
}
}
+void qdev_prop_set_globals_for_type(DeviceState *dev, const char *typename,
+ Error **errp)
+{
+ GlobalProperty *prop;
+
+ QTAILQ_FOREACH(prop, &global_props, next) {
+ Error *err = NULL;
+
+ if (strcmp(typename, prop->driver) != 0) {
+ continue;
+ }
+ qdev_prop_parse(dev, prop->property, prop->value, &err);
+ if (err != NULL) {
+ error_propagate(errp, err);
+ return;
+ }
+ }
+}
+
void qdev_prop_set_globals(DeviceState *dev, Error **errp)
{
ObjectClass *class = object_get_class(OBJECT(dev));
do {
- GlobalProperty *prop;
- QTAILQ_FOREACH(prop, &global_props, next) {
- Error *err = NULL;
+ Error *err = NULL;
- if (strcmp(object_class_get_name(class), prop->driver) != 0) {
- continue;
- }
- qdev_prop_parse(dev, prop->property, prop->value, &err);
- if (err != NULL) {
- error_propagate(errp, err);
- return;
- }
+ qdev_prop_set_globals_for_type(dev, object_class_get_name(class),
+ &err);
+ if (err != NULL) {
+ error_propagate(errp, err);
+ return;
}
class = object_class_get_parent(class);
} while (class);